Match Case Statements in Python
print("\nThe capital of the following countries can be known.\nPakistan\nIndia\nTurkey\nIran\n")
cName = input("Plz enter country name: ")
match cName:
case "Pakistan":
print("The capital is Islamabad.\n")
case "India":
print("The capital is New Delhi.\n")
case "Turkey":
print("The capital is Ankara.\n")
case "Iran":
print("The capital is Tehran.\n")
case _: #default case
print("Sorry! This country is not in our database.\n")
Comments
Post a Comment
Write something to CodeWithAbdur!