Condition

Estimated reading time: 1 minute

condition

if

a = True
if a:
  print("kamal is a code artist")
else:
  print("code4mk org")
# kamal is a code artist

elif

name = "kamal"
if name == "code4mk":
  print("User name is code4mk")
elif name == "kamal":
  print("User name is kamal")
else:
  print("Unknown User")
# User name is kamal

and

username = "kamal"
password = "ka23"

if username == "kamal" and password == "1k23":
  print("success")
else:
  print("password or username is wrong")
# password or username is wrong

or

username = "kamal"
password = "ka23"

if username == "kamal" or password == "1k23":
  print("success")
else:
  print("password or username is wrong")
# success
python