Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple login problem
#1
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.
Reply
#2
https://python-forum.io/Thread-Multiple-...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 ''
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Feb-18-2020, 11:56 AM)buran Wrote: https://python-forum.io/Thread-Multiple-...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 ''

Thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  A simple problem, how best to solve it? SuchUmami 2 718 Sep-01-2023, 05:36 AM
Last Post: Pedroski55
  How to solve this simple problem? Check if cvs first element is the same in each row? thesquid 2 1,225 Jun-14-2022, 08:35 PM
Last Post: thesquid
Big Grin question about simple algorithm to my problem jamie_01 1 1,669 Oct-04-2021, 11:55 AM
Last Post: deanhystad
  in a login interface when i try login with a user supposed to say test123 but nothing NullAdmin 3 2,264 Feb-20-2021, 04:43 AM
Last Post: bowlofred
  How to make a simple automation process of login using "if condition" soimba 3 2,745 Jan-07-2020, 11:58 PM
Last Post: SheeppOSU
  Problem with simple 3D Vektor calculation Pythocodras 0 1,708 Dec-11-2019, 07:18 PM
Last Post: Pythocodras
  Simple problem. looking for an efficient way silverchicken24 3 2,325 Oct-14-2019, 07:13 PM
Last Post: Larz60+
  help with simple LOGIN code pedrosa06 3 2,493 Jun-27-2019, 03:58 PM
Last Post: ichabod801
  simple string & input problem kungshamji 5 3,648 Jun-23-2019, 03:54 PM
Last Post: kungshamji
  Array - Problem with Simple Code emerger 8 4,400 Oct-12-2018, 02:46 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020