From e638b14e292404077d5706487671defda84e8e6a Mon Sep 17 00:00:00 2001 From: Sarthak Gupta Date: Wed, 22 Oct 2025 23:40:42 +0530 Subject: [PATCH] added KBC_game --- KBC_game/KBC.py | 164 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 KBC_game/KBC.py diff --git a/KBC_game/KBC.py b/KBC_game/KBC.py new file mode 100644 index 0000000..9e1a0ac --- /dev/null +++ b/KBC_game/KBC.py @@ -0,0 +1,164 @@ +print("Welcome to Kaun Banega Crorepati!") + +dict1 = { "question": "Q1. What is the national bird of India?", + "options": {1:"1-Sparrow", 2:"2-Peacock", 3:"3-Parrot", 4:"4-Eagle"}, + "answer":2, "amount": "₹1,000" } +dict2 = { "question": "Q2. What is the capital of India?", + "options": {1:"1-Mumbai", 2:"2-New Delhi", 3:"3-Kolkata", 4:"4-Chennai"}, + "answer":2, "amount": "₹2,000" } + +dict3 = { "question": "Q3. Which river is considered the holiest in India?", + "options": {1:"1-Yamuna", 2:"2-Ganga", 3:"3-Godavari", 4:"4-Brahmaputra"}, + "answer": 2, "amount": "₹3,000" } + +dict4 = { "question": "Q4. What is the currency of India?", + "options": {1:"1-Dollar", 2:"2-Euro", 3:"3-Rupee", 4:"4-Dinar"}, + "answer": 3, "amount": "₹5,000" } + +dict5 = { "question": "Q5. Who was the first Prime Minister of India?", + "options": {1:"1-Jawaharlal Nehru", 2:"2-Mahatma Gandhi", 3:"3-Sardar Patel", 4:"4-Subhash Chandra Bose"}, + "answer": 1, "amount": "₹10,000" } + +dict6 = { "question": "Q6. Who wrote the Indian national anthem?", + "options": {1:"1-Bankim Chandra Chatterjee", 2:"2-Rabindranath Tagore", 3:"3-Sarojini Naidu", 4:"4-Lala Lajpat Rai"}, + "answer": 2, "amount": "₹20,000" } + +dict7 = { "question": "Q7. In which state is the Sun Temple of Konark located?", + "options": {1:"1-Odisha", 2:"2-Bihar", 3:"3-Rajasthan", 4:"4-Madhya Pradesh"}, + "answer": 1, "amount": "₹40,000" } + +dict8 = { "question": "Q8. Which Indian festival is also known as the festival of lights?", + "options": {1:"1-Holi", 2:"2-Diwali", 3:"3-Navratri", 4:"4-Dussehra"}, + "answer": 2, "amount": "₹80,000" } + +dict9 = { "question": "Q9. Which sport is known as the national sport of India?", + "options": {1:"1-Cricket", 2:"2-Hockey", 3:"3-Kabaddi", 4:"4-Football"}, + "answer": 2, "amount": "₹1,60,000" } + +dict10 = { "question": "Q10. What is the name of India's first satellite?", + "options": {1:"1-INSAT-1A", 2:"2-Rohini", 3:"3-Bhaskara", 4:"4-Aryabhata"}, + "answer": 4, "amount": "₹3,20,000" } + +dict11 = { "question": "Q11. Who is known as the Missile Man of India?", + "options": {1:"1-Homi Bhabha", 2:"2-APJ Abdul Kalam", 3:"3-Vikram Sarabhai", 4:"4-Satish Dhawan"}, + "answer": 2, "amount": "₹4,00,000" } + +dict12 = { "question": "Q12. Which Indian city is also known as the 'Pink City'?", + "options": {1:"1-Jodhpur", 2:"2-Udaipur", 3:"3-Jaipur", 4:"4-Bikaner"}, + "answer": 3, "amount": "₹5,00,000" } + +dict13 = { "question": "Q13. Who built the Red Fort in Delhi?", + "options": {1:"1-Akbar", 2:"2-Shah Jahan", 3:"3-Babur", 4:"4-Aurangzeb"}, + "answer": 2, "amount": "₹6,00,000" } + +dict14 = { "question": "Q14. Which Indian state has the longest coastline?", + "options": {1:"1-Maharashtra", 2:"2-Tamil Nadu", 3:"3-Andhra Pradesh", 4:"4-Gujarat"}, + "answer": 4, "amount": "₹7,00,000" } + +dict15 = { "question": "Q15. In which year did India win its first Cricket World Cup?", + "options": {1:"1-2011", 2:"2-2003", 3:"3-1983", 4:"4-1975"}, + "answer": 3, "amount": "₹8,00,000" } + +dict16 = { "question": "Q16. Which Indian city is called the Silicon Valley of India?", + "options": {1:"1-Hyderabad", 2:"2-Bengaluru", 3:"3-Pune", 4:"4-Chennai"}, + "answer": 2, "amount": "₹9,00,000" } + +dict17 = { "question": "Q17. Who composed the music for the Indian National Anthem?", + "options": {1:"1-Rabindranath Tagore", 2:"2-A.R. Rahman", 3:"3-Laxmikant-Pyarelal", 4:"4-Madan Mohan"}, + "answer": 1 , "amount": "₹10,00,000" } + +dict18 = { "question": "Q18. Which freedom fighter is known as 'Punjab Kesari'?", + "options": {1:"1-Udham Singh", 2:"2-Bhagat Singh", 3:"3-Lala Lajpat Rai", 4:"4-Chandrashekhar Azad"}, + "answer": 3 , "amount": "₹11,00,000" } + +dict19 = { "question": "Q19. Which Indian classical dance form originated in Tamil Nadu?", + "options": {1:"1-Kathak", 2:"2-Bharatanatyam", 3:"3-Odissi", 4:"4-Kuchipudi"}, + "answer": 2, "amount": "₹12,00,000" } + +dict20 = { "question": "Q20. Who was the first Indian to receive a Nobel Prize?", + "options": {1:"1-Amartya Sen", 2:"2-Mother Teresa", 3:"3-Rabindranath Tagore", 4:"4-C.V. Raman"}, + "answer": 3, "amount": "₹13,00,000" } + +dict21 = { "question": "Q21. What is the name of India's first nuclear test operation?", + "options": {1:"1-Smiling Buddha", 2:"2-Shakti", 3:"3-Agni", 4:"4-Trishul"}, + "answer": 1 , "amount": "₹14,00,000" } + +dict22 = { "question": "Q22. Which Indian city is famous for Charminar?", + "options": {1:"1-Delhi", 2:"2-Hyderabad", 3:"3-Lucknow", 4:"4-Bhopal"}, + "answer": 2 , "amount": "₹15,00,000" } + +dict23 = { "question": "Q23. What is the name of the highest civilian award in India?", + "options": {1:"1-Padma Bhushan", 2:"2-Padma Shri", 3:"3-Bharat Ratna", 4:"4-Ashoka Chakra"}, + "answer": 3, "amount": "₹25,00,000" } + +dict24 = { "question": "Q24. Which Indian scientist developed the first Indian nuclear reactor?", + "options": {1:"1-Homi Bhabha", 2:"2-Vikram Sarabhai", 3:"3-Meghnad Saha", 4:"4-APJ Abdul Kalam"}, + "answer": 1 , "amount": "₹75,00,000" } + +dict25 = { "question": "Q25. Which Indian mathematician is known for infinite series, continued fractions, and had no formal training in mathematics?", + "options": {1:"1-Aryabhata", 2:"2-Bhaskara I", 3:"3-C.V. Raman", 4:"4-Srinivasa Ramanujan"}, + "answer": 4, "amount": "₹1 crore" } + + + +# This function simulates a simple version of the Kaun Banega Crorepati game + +def kbc(dict1): + print("Question for:",dict1["amount"] ) + print("Question:",dict1["question"]) + + # for op,ans in dict1["options"].items(): + # print(f"{op}: {ans}") + + print(dict1["options"][1] ,dict1["options"][2]) + print( dict1["options"][3] ,dict1["options"][4]) + + useranswer=int(input("Enter your answerin(1-4):")) + if useranswer== dict1["answer"]: + print("Correct answer!") + print("you have wonn:",dict1["amount"]) + if dict1["amount"]=="₹10,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹3,20,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹8,00,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹15,00,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + else: + print("YOU ARE TAKING MONEY HOME= NOTHING") + print(" ") + else: + print("Wrong answer!") + print("The correct answer is:", dict1["answer"]) + if dict1["amount"]=="₹10,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹3,20,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹8,00,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + elif dict1["amount"]=="₹15,00,000": + print("YOU ARE TAKING MONEY HOME=",dict1["amount"]) + else: + print("YOU ARE TAKING MONEY HOME=NOTHING") + print("You have won",dict1["amount"]) + return False # Indicates that the user answered incorrectly and the game should enD + + return True # Indicates that the user answered correctly and can continue playing + +# kbc(dict1) # Call the function to start the game +# kbc(dict2) # Call the function to start the game +# kbc(dict3) # Call the function to start the game +# kbc(dict4) # Call the function to start the game +# kbc(dict5) # Call the function to start the game + +questions = [dict1, dict2, dict3, dict4, dict5 , dict6, dict7, dict8, dict9, dict10, + dict11, dict12, dict13, dict14, dict15, dict16, dict17, dict18, dict19, dict20, + dict21, dict22, dict23, dict24, dict25] + + +for q in questions: + if not kbc(q): + print("Game Over!") + break +