top of page

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


 
 
 

Recent Posts

See All
The situation of physics in India

Hard to win fields medal for field theory after an unforgiving D grade in a theory course in 2010 for working on quantum optics due to lack of time and they then talked to all scientists not to give

 
 
 
Quantum wish

[6/6, 4:48 AM] Harish Exinc: Why is copper sulphate and potassium permanganate the best choice to do titration at home as it's least reactive and shows end result with transperant ness so just showing

 
 
 

Comments


bottom of page