i just started programing and i cant figure out why this this if statment alwayse executes
Month = input("Enter name of month: ")
if Month == 'September' or 'April' or 'June' or 'November':
print("There are 30 days in that month")
i just started programing and i cant figure out why this this if statment alwayse executes
Month = input("Enter name of month: ")
if Month == 'September' or 'April' or 'June' or 'November':
print("There are 30 days in that month")
You could use in
list
Month = input("Enter name of month: ")
if Month in {'September','April','June','November'}:
print("There are 30 days in that month")
Your if
should be:
if Month == 'September' or Month == 'April' or Month == 'June' or Month == 'November':
When you just right a string (in your case 'April' for instance) or a number that is different than 0 it evaluates to something that is not 0 and so the entire condition is evaluated as True and thats why it always executes the if