#20 code challenge email validator leon heaney mbugua #email=input("enter your email adress") # #if "@" not in email and "." not in email: # print("your email is not valid try again") # email=invalid # #else: # ("your email is valid") # email=valid # #while email == invalid: # #this was my first attempt but the code wouldn't loop to the top of the code if you got the email invalid invalid_input = True def start() : print ("Hello and welcome to email international") email = input ("please enter your email adress") if "@" not in email == "1": #stuff print("your email doesn't contain an @. Please try again") invalid_input = False # Set to False because input was valid elif "." not in email == "2": #stuff print("your code does not contain a dot. please try again") invalid_input = False # Set to False because input was valid elif email == "3": # you still have this as "if"; I would recommend keeping it as elif #stuff invalid_input = False # Set to False because input was valid #elif "@." in email == "4": #stuff #print(" else: print ("Your code is valid welcome to email international") #break while invalid_input : # this will loop until invalid_input is set to be True start()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question