simple login problem - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: simple login problem (/thread-24534.html) |
simple login problem - MMOToaster - Feb-18-2020 numbertable = ["1","2","3","4","5","6","7","8","9"] fname= input("Your First name?") lname = input("Your Last name?") if " " in fname or lname: print("No space!") elif numbertable[0:8] in fname or lname: print("No number!")Hey, so I wanted to do a login program in which the first and last of the user are being asked and then there is a check if in either of the variables is a space(since names can't have spaces) or a number(since names can't have numbers in them). The problem is that with inputs such as: fname = 123 lname = 456 or fname = Mike lname = Bob it still puts out: No space! My assumption is that in line 4 there is a problem with the if condition, but I have no clue what I did wrong there. Could anyone help me with this? Thank you in advance. RE: simple login problem - buran - Feb-18-2020 https://python-forum.io/Thread-Multiple-expressions-with-or-keyword if " " in fname or lname is same as if (" " in fname) or lname and it always be True if lname is not empty str ''
RE: simple login problem - MMOToaster - Feb-25-2020 (Feb-18-2020, 11:56 AM)buran Wrote: https://python-forum.io/Thread-Multiple-expressions-with-or-keyword Thank you! |