The starter is always set to one specific one

39 Views Asked by At

I have a script that in theory should choose a pokemon starter and continue, but the program is only letting one starter be chosen no matter what you type.

starter = input("Which Pokemon will you choose?").lower()

if starter == "Bulbasaur":
  print("You chose Bulbasaur")
  print(rival_name + ": I choose you, Charmander!")
elif starter == "Charmander":
  print("You chose Charmander")
  print(rival_name + ": I choose you, Squirtle!")
else:
  print("You chose Squirtle")
  print(rival_name + ": I choose you, Bulbasaur!")
  

I expected you to be able to choose any one of the three but the program is not functioning correctly (it is only picking Squirtle)

2

There are 2 best solutions below

0
Mike On

Your problem is since you lowered the string starter it cannot equal "anything with captitals" Soution is to decapitalise the strings in the if statements.

starter = input("Which Pokemon will you choose?").lower()

if starter == "bulbasaur":
  print("You chose Bulbasaur")
  print(rival_name + ": I choose you, Charmander!")
elif starter == "charmander":
  print("You chose Charmander")
  print(rival_name + ": I choose you, Squirtle!")
else:
  print("You chose Squirtle")
  print(rival_name + ": I choose you, Bulbasaur!")
  
0
Jenish Patel On

In the above question of very first line you mention .lower() and starter == "Bulbasaur" is start with the capital letter because of this problem ever time you print the above statement it goes in else statement and you will never get your desire output.

starter = input("Which Pokemon will you choose?")

if starter == "Bulbasaur":
  print("You chose Bulbasaur")
  print(starter + ": I choose you, Charmander!")
elif  starter == "Charmander":
  print("You chose Charmander")
  print(starter + ": I choose you, Squirtle!")
else:
  print("You chose Squirtle")
  print(starter + ": I choose you, Bulbasaur!")