Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#This code will tell the age of the person that inputs their name

input("Enter Name:")
name = ("Tosin") or ("Toyin")
if name == ("Tosin"):
print(20)
if name == ("Toyin"):
print(12)``
else:
print("Try again")

What I have tried:

#This code will tell the age of the person that inputs their name

input("Enter Name:")
name = ("Tosin") or ("Toyin")
if name == ("Tosin"):
print(20)
if name == ("Toyin"):
print(12)``
else:
print("Try again")
Posted
Updated 20-Jan-19 22:16pm
Comments
Mohibur Rashid 20-Jan-19 17:30pm    
Try this
name=input("Enter name(toshin or toyin)")
Richard MacCutchan 21-Jan-19 3:54am    
Your code always sets name = "Tosin".

1 solution

As suggested, change your code this way:
Python
name =  input("Enter Name: (Tosin or Toyin) ")
if name == ("Tosin"):
  print(20)
elif name == ("Toyin"):
  print(12)
else:
  print("Try again")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900