Skip to content
Advertisement

how to fix my if condition when to validate the day and month

def user_input_validation(user_input_month , user_input_day):
 if user_input_month < 1 or user_input_month > 12 :
  valid_month = False
  print ("Invalid month. Please enter a number between 1-12")
 else :
  valid_month = True
 if user_input_day  < 1 or user_input_day > 31 : 
  valid_day = False
  print ("Invalid day. Please enter a number between 1-12")
 else :
  valid_day = True 
 if valid_month=True and valid_day = True :
   return True

my error massage File “”, line 13 if valid_month = True and valid_day = True : ^ SyntaxError: invalid syntax

Advertisement

Answer

in if statement we should use double == the right syntax is

if valid_month==True and valid_day ==True :

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement