-1
的代碼,我有:的Python使得一些猜謎遊戲
import random
guessesTaken = 0
print('Hello! What is your name?')
myName = input()
number = random.randint(1, 20)
print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')
while guessesTaken < 5:
print('Take a guess.')
guess = input()
guess = int(guess)
guessesTaken = guessesTaken + 1
guessesTaken = print('Thats a guess gone.')
if guess < number:
print('Your guess is too low.')
if guess > number:
print('Your guess is too high.')
if guess == number:
print('You won at life!')
break
if guess == number:
print('idk, ' + myName + '! You guessed my number in ' + guessesTaken + ' guesses!')
print('Again? Again.')
需要幫助的:
1,本錯誤 - 回溯(最近通話最後一個):
File "\\wbs-fs01\2013$\13CDyke\Guessing game.py", line 12, in <module>
while guessesTaken < 5:
TypeError: unorderable types: NoneType() < int()
2 。。需要解決它,並顯示你有多少猜測得到的答案
感謝那些工作,也能不能幫我讓它重複在輸入類似「是」或「否」 –
@OBCCraig堆棧溢出已經幫助了一萬億別人去做。這兩個例如:http://stackoverflow.com/questions/12557376/python-repeat-program-while-true http://stackoverflow.com/questions/36273970/how-do-i-repeat-the-program/ 36274003 –