猜數字11.9

kill the saber發表於2020-11-09
import random
n=int(random.random()*50+1)
i=1
while i <= 5:
a=int(input(“請輸入數字:”))
if(a < n):
print(“你輸入的數小了”)
i = i + 1
elif(a > n):
print(“你輸入的數大了”)
i = i + 1
else:
print(“恭喜你猜對了”)
break
else:
print(“你已經猜了5次了,本局是你敗北”)

相關文章