Код: Выделить всё
# Exercise 4 - Beginner
while True:
print("~~~~~ THE 100 GAME - CODED BY SASU ~~~~~")
print('----- MENU -----')
print('1 - Start multiplayer game')
print('2 - Quit game')
choice = int(input('What are you going to do? Input the number representing your choice.'))
if choice == 1:
print('Let's do it!')
elif choice == 2:
print('See you soon.')
break # In order to stop the program and quit
else:
print('What the heck? Type again.')
print("~~~~~ THE 100 GAME - CODED BY SASU ~~~~~")
print('----- MENU -----')
print('1 - Start multiplayer game')
print('2 - Quit game')
choice = int(input('What are you going to do? Input the number representing your choice.'))
if choice == 1:
print('Let's do it!')
elif choice == 2:
print('See you soon.')
break # In order to stop the program and quit
else:
print('What the heck? Type again.') # After this it just starts the multiplayer game right away I don't know how to fix this
while True:
print('Yooo player 1, tell me your name:')
oneName = input()
print('Well then, player 2, what about ya?')
twoName = input()
print('Well hey there, ' + oneName + ' and ' + twoName + ', and welcome to 100!')
print('You will each take turns to choose a number between 1 and 10.')
print('The first person to reach 100 is the winner.')
print("Have fun, and let's get started!")
totalNumber = 0
while True:
while totalNumber < 100:
numberOne = input(oneName + ', give me a number between 1 and 10.') # I don't know how to limit the range though
numberOne = int(numberOne)
totalNumber += numberOne
print("Got it, " + oneName + "! Below is the total right now:")
print(totalNumber)
break
while totalNumber < 100:
numberTwo = input(twoName + ', give me a number between 1 and 10.')
numberTwo = int(numberTwo)
totalNumber += numberTwo
print("Got it, " + twoName + "! Below is the total right now:")
print(totalNumber)
break
Подробнее здесь: https://stackoverflow.com/questions/452 ... ame-python
Мобильная версия