online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import random t=0 while t==0: def cricket(y): while 1: userno=int(input('Enter your number : ')) if userno in [1,2,3,4,6]: compno=random.choice([1,2,3,4,6]) if userno==compno : return 12 else : if y==1: return userno else: return compno break else: print(' *********Invalid Selection...Plz try again') #-------------------------------------------------------------------------------------- def scoreboard(us,cs): print('___________________________________________________________________________________') print(' Score Board :') print(' Your score :',us) print(' Computer score :',cs) #-------------------------------------------------------------------------------------- print(' ...............N U M B E R C R I C K E T G A M E.................') tosslist=['h','t'] compselection=['bat','ball'] while 1: player=input('Whats your toss..(h or t) : ') if player=='h' or player=='t': player=player.lower() break else: print(' *********Invalid Selection...Plz try again') toss=random.choice(tosslist) if toss==player : print('You Won The Toss...') while 1: user_choice=input('Enter your choice(Bat/Ball) : ') if user_choice=='bat' or user_choice=='ball': choice=user_choice.lower() break else: print(' ********Invalid Selection...Plz try again') else: i=random.choice(compselection) if i=='bat': choice='ball' else: choice='bat' print('Computer won the toss and chooses ',i,'first..............') uscore=0 cscore=0 cond=0 x=0 if choice=="bat": print(' lets start batting..............\n') x=1 else : print(' lets start Bowling..............\n') x=2 #-------------------------------------------------------------------------------------- while cond==0 : a=cricket(x) if a==12 : if choice=="bat": x=2 print(' Computer has Guessed your number\n') print(' Your total score : ',uscore) else: x=1 print(' You Guessed Computer number\n') print(' Computer total score : ',cscore) cond=12 else : if choice=="bat": uscore+=a print(' your score = ',uscore) else : cscore+=a print(' computer score = ',cscore) print('\n\n') if choice=='bat': print(' lets start bowling..............\n') else : print(' lets start Batting..............\n') #-------------------------------------------------------------------------------------- cond=0 while cond==0 : a=cricket(x) if a==12 : if choice=="bat": print(' you guessed computer number...') scoreboard(uscore,cscore) print(' yeeeeh....You won the match........!!!!!!!!!!!!!!') else : print(' Computer guessed Your number...') scoreboard(uscore,cscore) print(' you loose the match........!!!!!!!!!!!!!!\n') cond=12 else : if choice=="bat": cscore+=a print(' Computer score = ',cscore) if cscore>uscore: print(' Computer Beats Your Score\n') scoreboard(uscore,cscore) print(' you loose the match........!!!!!!!!!!!!!!') break else : uscore+=a print(' Your score = ',uscore) if uscore>cscore: print(' You Beats Computer Score\n') scoreboard(uscore,cscore) print(' yeeeeh....You won the match........!!!!!!!!!!!!!!') break while 1: s=input('Do you want to play again (y or n) : ') if s=='y' or s=='n': if s=='n': t=1 break else: print(' **********************************************Invalid Selection...Plz try again')

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue