endswith python

#endswith() function: the function of string which returns the value matching 
#the argument or else returns nothing.
example: to check if the given email matches the domain of the sample email.

 a=input('enter email ID :')
if a.endswith('@draken.com'): # here suffix should come @draken.com prefix independent
 print('valid Email ID')
else:
 print('not valid Email ID')
#output
--------------------------------------------------------------------------------------
enter email ID :grayn@draken.com
valid Email ID
--------------------------------------------------------------------------------------
enter email ID :robin@dragon.com
not valid Email ID
--------------------------------------------------------------------------------------

Here is what the above code is Doing:
1. We take input from the user and store it in the variable a.
2. We use the endswith() function to check if the string stored in the variable a ends with ‘@draken.com’.
3. If the condition is true, we print ‘valid Email ID’.
4. If the condition is false, we print ‘not valid Email ID’.