0
print (' give me your name \n without any number ')
name=input('enter your name ')
print (name)
for i in name:
    if i == 1 or 2 or 3:
        print ('this name have number in it you failed ')
        print (i)       
    else:
        print ("you pass  ")

even if I entered the name with the number 1~3 or without it will choose the first statement why?

Patrick Haugh
  • 59,226
  • 13
  • 88
  • 96
  • 3
    Possible duplicate of [How do I test multiple variables against a value?](https://stackoverflow.com/questions/15112125/how-do-i-test-multiple-variables-against-a-value) – Patrick Haugh Mar 05 '18 at 01:12
  • 2
    the `or` is not working as you think. Try: `if i in (1, 2, 3)` – Stephen Rauch Mar 05 '18 at 01:12
  • You actually have three problems: you're doing letter by letter checks but printing a verdict each time, you're testing against integers `1, 2, 3` instead of characters `'1', '2', '3'`, and your `or` logic isn't correct. – Patrick Haugh Mar 05 '18 at 01:13

0 Answers0