猜数字Python实现

#coding=utf-8
#需求:实现让用户不断的猜数字,但只给最多10次机会,猜玩三次提示用户是否继续,最后猜不对就退出程序
nums1= 30
count=0
while(True):
nums2= int(raw_input("please enter nums"))
count+=1
if nums1 == nums2:
print "GOOD",count,"time"
break
elif count == 3:
print "please inter is or not count Y/y:N/n"
c1=raw_input("please inter is or not count Y/y:N/n")
if c1.upper() == 'Y':
break
elif count == 10:
print "10 time is over"
break

原文地址:https://www.cnblogs.com/jackyu126/p/6053686.html