OneCompiler

J

Karnataka Quiz Program

Define a dictionary to store questions and answers

questions = {
"Which river systems flow through Karnataka and empty into the Bay of Bengal?": "River Krishna and Kaveri",
"What was Karnataka previously known as?": "State of Mysore (renamed in 1973)",
"Which national park is located in Karnataka?": "Bandipur National Park",
"Name a bird sanctuary in Karnataka.": "Gudavi Bird Sanctuary or Mandagadde Bird Sanctuary",
"What are the major regional festivals celebrated in Karnataka?": "Dussera, Yogadi, Hampi festival, etc.",
"Which folk dance is associated with Karnataka?": "Nati",
"How many districts are there in Karnataka?": "30",
"What is the state animal of Karnataka?": "Asian elephant"
}

Function to display questions and check answers

def ask_question(question, answer):
user_answer = input(f"{question} (Answer: ")
if user_answer.lower() == answer.lower():
print("Correct! 🌟")
else:
print(f"Oops! The correct answer is: {answer}")

Main quiz loop

print("Welcome to the Karnataka Quiz!")
for question, answer in questions.items():
ask_question(question, answer)

print("Thanks for playing! 🎉")

No answers yet!

1 year ago by