猜数字游戏原子
Guess The Number Game Atom
我正在猜数字游戏,但我的代码不在 Atom 上 运行ning。由于某种原因,它不允许我使用输入。-
这是我的代码:
import time
import random
again = 'yes'
print('Loading please wait... ')
time.sleep(2)
print('Hello and welcome to Guessmania!')
name = input('To start please enter your name: ')
name = name.capitalize()
time.sleep(1)
print('Hello ' + name + ', In this game I will choose a number between 1 and 20 and you must guess it in 5 attempts. ')
time.sleep(3)
print('With me telling you whether your guess is too high or too low.')
while again == 'yes' or again =='Y' or again == 'Yes':
number = random.randint(1, 20)
guessesFinished = 0
time.sleep(2)
print('Are you Ready?')
time.sleep(2)
print('Well, ' + name + ', I am guessing a number between 1 and 20. ')
time.sleep(1)
for guessesFinished in range(5): #5 guesses to get it right
guess = int(input('Have a guess: '))
if guess < number:
print('Your guess is too low.')
if guess > number:
print('Your guess is too high.')
if guess == number:
break
if guess == number:
guessesFinished = str(guessesFinished + 1)
print('Great work ' + name + '! You guessed the number I chose in ' + guessesFinished + ' guesses!')#Shows that user has won or lost
if guess != number:
number = str(number)
print('Sorry. The number I was chose was ' + number + '.')
again = input('Would you like to play the Guess the Number Game again? ')#asking user if they want to play again
print('Thank you for playing. Have a good day.')
我已经使用了这段代码,但是当我运行它时它不接受任何输入。
尝试使用其他包。我尝试使用一个包,但没有用。使用此包来 运行 代码。它被称为atom-python-run。这里是 Github link-https://github.com/foreshadow/atom-python-run
我正在猜数字游戏,但我的代码不在 Atom 上 运行ning。由于某种原因,它不允许我使用输入。- 这是我的代码:
import time
import random
again = 'yes'
print('Loading please wait... ')
time.sleep(2)
print('Hello and welcome to Guessmania!')
name = input('To start please enter your name: ')
name = name.capitalize()
time.sleep(1)
print('Hello ' + name + ', In this game I will choose a number between 1 and 20 and you must guess it in 5 attempts. ')
time.sleep(3)
print('With me telling you whether your guess is too high or too low.')
while again == 'yes' or again =='Y' or again == 'Yes':
number = random.randint(1, 20)
guessesFinished = 0
time.sleep(2)
print('Are you Ready?')
time.sleep(2)
print('Well, ' + name + ', I am guessing a number between 1 and 20. ')
time.sleep(1)
for guessesFinished in range(5): #5 guesses to get it right
guess = int(input('Have a guess: '))
if guess < number:
print('Your guess is too low.')
if guess > number:
print('Your guess is too high.')
if guess == number:
break
if guess == number:
guessesFinished = str(guessesFinished + 1)
print('Great work ' + name + '! You guessed the number I chose in ' + guessesFinished + ' guesses!')#Shows that user has won or lost
if guess != number:
number = str(number)
print('Sorry. The number I was chose was ' + number + '.')
again = input('Would you like to play the Guess the Number Game again? ')#asking user if they want to play again
print('Thank you for playing. Have a good day.')
我已经使用了这段代码,但是当我运行它时它不接受任何输入。
尝试使用其他包。我尝试使用一个包,但没有用。使用此包来 运行 代码。它被称为atom-python-run。这里是 Github link-https://github.com/foreshadow/atom-python-run