#data validity checking #validIf.py num = eval(input("Enter a number between 1 and 10: ")) #true if invalid, i.e. out of range if num<1 or num>10: print("Error. Invalid data") #true if valid, i.e. in range. opposite test of above if num>=1 and num<=10: print("Thanks for good input data") #true if valid, i.e. in range if 1 <= num <= 10: print("Thanks for good input data") #SYNTAX ERROR: try it and see #can't have relational operator and logical operator adjacent #if num<1 or >10: # print("bad bad bad boolean expression!") #WRONG. not asking if num equals 2 or 4 #Python is not English if num == 2 or 4: print("ALWAYS true! useless and wrong") #this is how to ask if num is 2 or 4: if num==2 or num==4: print("it's 2 or it's 4")