Python games Guess

import random
import time
starttime=time.time()
n=1
print('-----------------')
random.randint a = (1.10)
guess = int (input ( 'Guess what number I was thinking:'))
while guess!=a:
    if guess<a:
        print('bigger')
    if guess>a:
        print('smaller')
    if n>3:
        print('sorry ,no times for u')
        break
    n=n+1
    guess=int(input('load again:'))
while guess==a:
    endtime=time.time()
    time=int(endtime-starttime)
    print ( 'guessed, the game ends. A total guess for% d% d seconds when using'% (n, time))

#while cycle to increase the frequency and program run repeatedly
#while cycle, when executed true loop condition


Guess you like

Origin www.cnblogs.com/xiaosagege/p/12513366.html