python 猜数字小程序
1 import random 2 x = random.randrange(1,99,1) 3 while 1: 4 i=int(input("please input the age you guess")) 5 if i>x: 6 print ("too large") 7 elif i<x: 8 print ("too small") 9 else : 10 print ("bigo") 11 break
随便用
1 import random 2 x = random.randrange(1,99,1) 3 while 1: 4 i=int(input("please input the age you guess")) 5 if i>x: 6 print ("too large") 7 elif i<x: 8 print ("too small") 9 else : 10 print ("bigo") 11 break