Answer the question
In order to leave comments, you need to log in
How to use endswith in a condition?
Good evening everyone! I'm a beginner, so I need help... It is necessary that when entering an email, the program checks for the presence of a certain word (for example, @mail.ru) and skips such mail, and if you enter another one, it gives an error, finds the endswith method, but I can’t figure out how to In my case it is correct to use it.
c = input ("Введите свой e-mail: ")
if c.endswith("mail.ru")
print("E-mail: " +str(c))
else:
print("Ошибка")
Answer the question
In order to leave comments, you need to log in
The colon is omitted. A beginner should read the tutorial to learn the basic syntax at least.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question