国产成人AV一区二区三区在线_国产成人精品无码免费看_国产成人无码无卡在线观看_国产精品成人A区在线观看_国产日韩精品欧美一区_国产亚洲精品自在久久蜜TV_久草热久草热线频97精品_久久久噜噜噜久久中文福利_久久婷婷五月综合色国产免费观看_日日狠狠久久偷偷色综合0,九一桃色在线观看,久久97精品久久久久久久不卡,国产成人精品亚洲精品

如何python做一個(gè)1-100的猜數(shù)游戲,,告訴我我猜的次數(shù)

訪客2024-12-03 17:20:311

完整的程序參考:

import randomsecret = random.randint(1,100)guess = 0tries = 0while int(guess) != secret and tries < 10: #最多猜10次print("第%d次,"%(tries+1),end='');guess = input ("輸入你的數(shù):")ifint(guess) < secret :print ("太小!")elifsecret < int(guess):print ("太大")tries = tries + 1if int(guess) == secret :print ("你猜對(duì)了,,共%d次"%(tries))else:print ("你10次都沒(méi)猜對(duì),數(shù)字為:",secret)

文章評(píng)論