if-else statement:-
If-else statement मे जब कोई condition true होगी तो if block का statement execute होगा। और जब कोई condition false होगी तो else block का statement execute होगा।
Syntax:-
if condition :
statement 1 (s)
else :
statement 1 (s)
Example:-
email = “xyz@gmail.com” passwd = “123450022” em = input (“enter email—— “) pa = input (“enter your passwd —- “) if email==em and passwd ==pa : print (” log in. “) else : print (“wrong email id ..”) # output 1 :– enter email—— xyz@gmail.com enter your passwd —- 12345 log in. |
if-else statement:-
When any condition in the if-else statement is true then the statement of the if block will be executed. And when any condition is false then the statement of else block will be executed.
Syntax:-
if condition :
statement 1 (s)
else :
statement 1 (s)
Example:-
email = “xyz@gmail.com” passwd = “123450022” em = input (“enter email—— “) pa = input (“enter your passwd —- “) if email==em and passwd ==pa : print (” log in. “) else : print (“wrong email id ..”) # output 1 :– enter email—— xyz@gmail.com enter your passwd —- 12345 log in. |