My very basic python program will not work and I don't know why maybe I am blind and tired but I can't tell
Question:
why do i get this error for this:
prisoners = input('How many player(s): ')
print = ('Welcome to Prison break!')
if int(prisoners) == 1:
print('Welcome solo player, bravest of the brave')
elif 2 <= int(prisoners) <5 :
print('Welcome prisoners, hold on to each other tight')
elif 1 > int(prisoners):
print('Whoops, this game is 1-4 players. ')
elif 4 < int(prisoners):
print('Whoops, this game is 1-4 players. ')
err:raceback (most recent call last):
File "/Users/aiyoobaman/Documents/vscode/stuff.py", line 7, in <module>
print('Welcome solo player, bravest of the brave')
TypeError: 'str' object is not callable
Please help.
Answers:
You need to change the second line
prisoners = input('How many player(s): ')
print('Welcome to Prison break!')
if int(prisoners) == 1:
print('Welcome solo player, bravest of the brave')
elif 2 <= int(prisoners) <5 :
print('Welcome prisoners, hold on to each other tight')
elif 1 > int(prisoners):
print('Whoops, this game is 1-4 players. ')
elif 4 < int(prisoners):
print('Whoops, this game is 1-4 players. ')
why do i get this error for this:
prisoners = input('How many player(s): ')
print = ('Welcome to Prison break!')
if int(prisoners) == 1:
print('Welcome solo player, bravest of the brave')
elif 2 <= int(prisoners) <5 :
print('Welcome prisoners, hold on to each other tight')
elif 1 > int(prisoners):
print('Whoops, this game is 1-4 players. ')
elif 4 < int(prisoners):
print('Whoops, this game is 1-4 players. ')
err:raceback (most recent call last):
File "/Users/aiyoobaman/Documents/vscode/stuff.py", line 7, in <module>
print('Welcome solo player, bravest of the brave')
TypeError: 'str' object is not callable
Please help.
You need to change the second line
prisoners = input('How many player(s): ')
print('Welcome to Prison break!')
if int(prisoners) == 1:
print('Welcome solo player, bravest of the brave')
elif 2 <= int(prisoners) <5 :
print('Welcome prisoners, hold on to each other tight')
elif 1 > int(prisoners):
print('Whoops, this game is 1-4 players. ')
elif 4 < int(prisoners):
print('Whoops, this game is 1-4 players. ')