+ 1
can it is possible ? help
a code is asking for user input email address and if the user input his email address but forget to put @gmail.com at last so the output code should show that this email address is invalid
8 odpowiedzi
+ 2
Unless only Gmail addresses are valid, use a regex instead.
https://code.sololearn.com/cnbUBK5uKvnG/?ref=app
+ 3
I don't know Python but I can provide some pseudo code:
if not(inString(email, "@gmail.com")):
print "Invalid Email."
You basically want to test if "@gmail.com" is in the string email (assuming email is the variable name) and if it's not it's not in the string throw an error.
+ 2
Jan Markus I agree that regex is probably the best solution. It's very powerful and is used for this exact purpose.
+ 2
Let's Lyrics If that's what you specifically want then read up on regex. It's exactly what you're looking for.
+ 2
The code I provided won't work. It's pseudo code. I don't know Python, but I know how in other languages. The code I showed is how it might look.
+ 1
hey guys did you understand what i mean to say is? i mean to say that when a user enter his email address eg. test@gmail.com the printed should be ok continuee but if the user enter his input test.com(no @gmail present) then it should show us this email is invalid
0
it is showing me an error if not(inString(email, "@gmail.com")):
print "Invalid Email."