0

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")
inspectorG4dget
  • 104,525
  • 25
  • 135
  • 234

2 Answers2

1

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")
AlexanderBrevig
  • 1,959
  • 12
  • 17
0

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

tomer.z
  • 973
  • 7
  • 24