[training] Python – 終極密碼

ans = 38

min = 0
max = 100

while(True):
    guess = int(input("Please input a number that between %d ~ %d : "%(min, max)))
    if (guess > ans):
        max = guess
    if (guess < ans):
        min = guess
    if (guess == ans):
        print("Bingo!!")
        break

返信を残す

あなたのメールアドレスは公開されません. 必須項目にはマークが付けられています *

このサイトはスパムを減らすためにAkismetを使用しています. コメントデータの処理方法について学ぶ.