top of page
Writer's pictureDr. Harish Ravi

My first successful game other than chess and Rubiks cube

Heres a game which guesses the number I have and tells with as many guesses as possible

a=2 import random n=0 ha=1 while ha==1: b=random.sample((1,2,4,3),1) n=n+1 print(b[0],n) if(b[0]==2): ha=0 print(ha) print('The random won in n monves ',n)

================== RESTART: C:/Users/haris/Desktop/game.py ================== 1 1 4 2 4 3 3 4 3 5 1 6 4 7 4 8 4 9 4 10 4 11 1 12 3 13 1 14 3 15 3 16 1 17 4 18 3 19 1 20 3 21 1 22 3 23 4 24 2 25 0 The random won in n monves 25 >>> ================== RESTART: C:/Users/haris/Desktop/game.py ================== 1 1 4 2 2 3 0 The random won in n monves 3 >>> ================== RESTART: C:/Users/haris/Desktop/game.py ================== 2 1 0 The random won in n monves 1 >>> ================== RESTART: C:/Users/haris/Desktop/game.py ================== 1 1 1 2 3 3 4 4 2 5 0 The random won in n monves 5 >>> ================== RESTART: C:/Users/haris/Desktop/game.py ================== 3 1 1 2 2 3 0 The random won in n monves 3


2 views0 comments

Recent Posts

See All

The major corn supplement problem..

That's all I had to add corn syrup to food and drink 5 ml... That's where I couldn't focus due to special mind boosters in corn... [1/13,...

Free road time

The biggest question is curved road to Iisc and maze way what's difference in time. Everybodies theoretical problem... Problem one for a...

bottom of page