您好,登錄后才能下訂單哦!
import random secret = random.randint(1, 30) guess = 0 tries = 0 print("我叫丁丁,我有一個(gè)秘密數(shù)字!") print("數(shù)字從1到30,你只有6次機(jī)會(huì)!") while int(guess) != secret and tries < 6: print("你猜的數(shù)字是?") guess = input() if int(guess) < secret: print("數(shù)字太小了!再猜!") elif int(guess) > secret: print("數(shù)字太大了!再猜!") tries = tries + 1 if int(guess) == secret: print("你真厲害!恭喜你猜對(duì)啦!") else: print("你猜錯(cuò)6次啦,下次再玩吧!") print("我的秘密數(shù)字是:", secret)
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。