Kaun Banega Crorepati: Exercise 3 - Solution & Shoutouts | Python Tutorial - Day #39

preview_player
Показать описание
Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

14:15
Harry Bhai Question to terminal me nazar hi nahi aa rahe hai lekin koi bat nhi me ne is ka hal dhond lya hai:


print("Welcome to KBC!")
questions = [
["1. Which Programming Language was used to create Facebook?", "Python", "HTML", "JavaScript", "PHP", "C++", 4],
["2. When is Windows 10 end of support by Microsoft?", "2026-Nov", "2055-Jun", "2025-Oct", "2034-May", "2024-Dec", 3],
["3. Which one is not a web browser?", "Chrome", "Linux", "Safari", "Firefox", "Edge", 2],
["4. What is HTTP used for?", "Email", "Gaming", "Coding", "Browsing", "Calling", 4],
["5. Which is a social media platform?", "Facebook", "Python", "ChatGPT", "Excel", "Capcut", 1],
["6. Which company owns YouTube?", "Meta", "Apple", "Google", "Microsoft", "Amazon", 3],
["7. What does VPN protect?", "Ads", "Privacy", "Speed", "Viruses", "User", 2],
["8. Which is a search engine?", "Bing", "WhatsApp", "Photoshop", "Discord", "Copilot", 1],
["9. What does a Firewall do?", "Boost Speed", "Delete Files", "Block Access", "Open Sites", "Burn Data", 3],
["10. What is 'www' short for?", "World Wide Web", "Web World Wibe", "Wonder Wide Web", "World Wide Well", "Wonderful World's Web", 1],
["11. Which Keyboard Key is used to Refresh?", "Ctrl", "R", "Esc", "F5", "/", 4],
["12. Which device connects to Wi-Fi?", "CPU", "Router", "Printer", "DVD", "TV", 2],
["13. What is 'Google' known as?", "Search Engine", "Social Media", "Operating System", "Chatbot", "Photo Editor", 1],
["14. Which is a File type for Images?", "PDF", "TXT", "JPG", "MP4", "EXE", 3],
["15. What is 'Ctrl + X' used for?", "Copy", "Cut", "Paste", "Undo", "Redo", 2],
["16. What is YouTube used for?", "Video Sharing", "Search Engine", "Code Editor", "Video Editor", 1],
]

levels = [1000, 2000, 3000, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 1250000,

money = 0
for i in range(0, len(questions)):
question = questions[i]
print("")
print(question[0])
print(f"Question for Rs. {levels[i]}")
print(f"1. {question[1]} 2. {question[2]}")
print(f"3. {question[3]} 4. {question[4]}")
reply = int(input("Enter your Answer 1-4: "))
if reply == question[-1]:
print(f"Correct Answer! You won Rs. {levels[i]}")
if(i == 4):
money = 10000
elif(i == 9):
money = 320000
elif(i == 14):
money =
elif(i == 16):
money =
else:
print(f"Wrong Answer!")
break
print(f"The money you are taking home is Rs.{money}!")



Answers:
1 wale ka 4 option correct hai,
2 wale ka 3 option correct hai,
3 wale ka 2 option correct hai,
4 wale ka 4 option correct hai,
5 wale ka 1 option correct hai,
6 wale ka 3 option correct hai,
7 wale ka 2 option correct hai,
8 wale ka 1 option correct hai,
9 wale ka 3 option correct hai,
10 wale ka 1 option correct hai,
11 wale ka 4 option correct hai,
12 wale ka 2 option correct hai,
13 wale ka 1 option correct hai,
14 wale ka 3 option correct hai,
15 wale ka 2 option correct hai,
16 wale ka 1 option correct hai. 😊

SparkleFunTV
Автор

only legends know that questions are not printed but still love u bhai

coolATHARV
Автор

Great way of doing this exercise in logical simple way

ozge-yagizfan
Автор

I did not exactly know what the question was all about but here is a try
questions = {
"What is the capital of India": "Delhi",
"What is the National Bird of India": "Peacock",
"What is the National Animal of India": "Tiger",
"How many states are there in India": "28",
}
Options = [
["Delhi", "Kolkata", "Mumbai", "Chennai"],
["Pigeon", "Crow", "humming bird", "Peacock"],
["Elephant", "Lion", "Tiger", "Liger"],
["9", "28", "31", "23"],
]
# print(len(questions))
l = len(questions)
i = 0
for key, value in questions.items():
# print(key)
# print(value)
ans = input(f"{key}?{Options[i]}: ")
i = i + 1
if value == ans:
continue
else:
print("You are out")
break

crjohnChan
Автор

Question ka price to h pr question hi nhi sirf option hi h😂😂

AbhiYadav-isje
Автор

This was my approach to the problem:
questions = ["Current Railway Minister of India is", "Which god is also known as ‘Gauri Nandan’?", "What does not grow on tree according to a popular Hindi saying?", "Which city is known as the Pink City of India?", "Who wrote India's National Anthem?", "How many major religions are there in India?", "When is the National Hindi Diwas celebrated?", "How many states are there in India?", "Where is India Gate located?", "Who wrote Vande Mataram?"]
optionA = ['Mamta Banarjee', 'Agni', 'Money', 'Banglore', 'Rabindranath Tagore', 6, '13 September', 28, 'Agra', 'Sarat Chandra Chattopadhyay']
optionB = ['Ram Vilash', 'Indra', 'Flowers', 'Maysore', 'Lal Bahadur Shastri', 7, '14 September', 29, 'Punjab', 'Rabindranath Tagore']
optionC = ['Ashwini Vaishnaw', 'Hanuman', 'Leaves', 'Jaipur', 'Chetan Bhagat', 8, '14 July', 31, 'Mumbai', 'Bankim Chandra Chatterjee']
optionD = ['Piyush Goyal', 'Ganesha', 'Fruits', 'Kochi', 'RK Narayan', 9, '15 August', 32, 'New Delhi', 'Ishwar Chandra Vidyasagar']

answers = ['Ashwini Vaishnaw', 'Ganesha', 'Money', 'Jaipur', 'Rabindranath Tagore', 6, '14 September', 28, 'New Delhi', 'Bankim Chandra Chatterjee']

rewards = [0, 1000, 2000, 3000, 5000, 10000, 20000, 40000, 80000, 160000, 320000]
reward = 0

number_of_correct_answers = 0
def answer_index_check(a):
if a == 1:
Index_answer = optionA[i]
if a == 2:
Index_answer = optionB[i]
if a == 3:
Index_answer = optionC[i]
if a == 4:
Index_answer = optionD[i]
if Index_answer == answers[i]:
return 1
else:
return 0
for i in range(len(questions)):
print(f"{questions[i]} \n Option A: {optionA[i]} Option B: {optionB[i]} \n Option C: {optionC[i]} Option D: {optionD[i]}")
answer = input("please enter your answer here: ")
try:
answer = int(answer)
except:
answer = answer.title()
try:
if answer == answers[i] or answer_index_check(answer) == 1:
print("Correct Answer!")
reward = reward + 1
else:
print("Wrong Answer!")
except:
print(f"Wrong Answer! The correct answer is {answers[i]}")
if reward > 0:
print(f"Congratulations! You have won {rewards[reward]} !!!")
else:
print("Sorry but you didn't get any answer correct!")

BlackStarGalaxyy
Автор

BRO YOUR ARE THE BEST TEACHER I EVER HAD

satpalyadav
Автор

Ye exercise krne me bohot mazza aaya tha!

adityapradhan
Автор

My code was way more efficient and maintainable!!! Really happy!

anant
Автор

i=0
for i in range(14):
print('Question Kidhar hai?')

meherajalisardar
Автор

Yahi pe peel deya....Ohh Bhai kya he mast video hai ye

avparadox
Автор

Epic dialogue of the day:- Yahi pe pel diya bhai ne😂😂😂😂😂
I have Watched that funny part many times, and still gonna see whenever i feel to laugh.😂😂😂
And thank you so much harry bhai for this hundred days of coding.
Aap bhi welcome mann me matt kehna yahi comment me reply pel dena 😂😂😂😂😂

satyamsingh
Автор

updation of money=levels[i] will also come after line print(f"Correct answer, you have won Rs. {levels[i]}"), so that at last when we print your take home money is{money}, this money amount gets updated

lakshyathakur
Автор

Pranam bhrata 🙏 apka bahutt baht dhanyawad 😄🧡😇🙏

anonymous____________________
Автор

a=input("Enter your name: ")
print(a, "Welcome to kaun bane ga crorepati")
print()
q={"What is the capital of India":"Delhi",
"What comes after 4":"5"
}
print()
op=[[
"Mumbai", "Delhi", "Kolkata", "Assam"
],
["2", "3", "5", "6"],
]
levels=[10, 20]
i=0
for key, value in q.items():
print("question for Rs.", levels[i])
print(f"\n{key}?")
for j in range(0, len(op)):
d = op[i]
print(f"a.{d[0]} b.{d[1]}")
print(f"c.{d[2]} d.{d[3]}")
ans=input("\nEnter your answer: ")
i += 1
if value==ans:
print(" correct answer")
print()
continue
else:
print("wrong answer ")
break



Someone please solve my problem my options are repeating 2 times😢

kabyadeepdutta
Автор

Check the Solution 👇👇👇
#actually for different options of lifeline i am changing questions
print("Welcome to 'Kaun Banega Crorepati' (KCB) 😊")
name=input("Enter your name: ")
print("Rules\n 1)Lifeline Options: (i)eliminates two incorrect options(ET).\n \t (ii)calls a preselected friend for help(call).\n \t (iii)polls the studio audience(poll).\n \t (iv)changes the current question.")
print("2)Progressive Prize Levels: The game consists of a series of multiple-choice questions with increasing difficulty.")
print("3)Elimination on Wrong Answer: If a contestant answers a question incorrectly, they are eliminated from the game and leave with the prize amount ")
print("So Lets begin!")
q1=["Which planet is known as the 'Red Planet'?", "A. Venus", "B. Mars", "C. Jupiter", "D. Saturn", "B"]
q2=["Who is the author of the Harry Potter series?", "A. J.R.R. Tolkien", "B. J.K. Rowling", "C. George R.R. Martin", "D. Stephen King", "B"]
q3=["What is the capital of Australia?", 'A. Sydney', 'B. Melbourne', 'C. Canberr', 'D. Perth', 'C']
q4=["Which of the following is the longest river in the world?", 'A. Amazon', 'B. Nile', 'C. Yangtze', 'D. Mississippi', 'B']
q5=["Who is known as the 'Father of the Indian Constitution'?", 'A. Mahatma Gandhi', ' B. B.R. Ambedkar', 'C. Jawaharlal Nehru', 'D. Sardar Vallabhbhai Patel', 'B']
q6=["Which chemical element has the symbol 'O'?", 'A. Oxygen', 'B. Gold', 'C. Osmium', 'D. Opal', 'A']
q7=["Which planet is known as the 'Red Planet'?", "A. Venus", "B. Mars", "C. Jupiter", "D. Saturn", "B"]
q8=["Who is the author of the Harry Potter series?", "A. J.R.R. Tolkien", "B. J.K. Rowling", "C. George R.R. Martin", "D. Stephen King", "B"]
q9=["What is the capital of Australia?", 'A. Sydney', 'B. Melbourne', 'C. Canberr', 'D. Perth', 'C']
q10=["Which of the following is the longest river in the world?", 'A. Amazon', 'B. Nile', 'C. Yangtze', 'D. Mississippi', 'B']
# b1=["Which planet is known as the 'Red Planet'?", "A. Venus", "B. Mars", "C. Jupiter", "D. Saturn", "B"]
# b2=["Who is the author of the Harry Potter series?", "A. J.R.R. Tolkien", "B. J.K. Rowling", "C. George R.R. Martin", "D. Stephen King", "B"]
# b3=["What is the capital of Australia?", 'A. Sydney', 'B. Melbourne', 'C. Canberr', 'D. Perth', 'C']

q=[q1, q2, q3, q4, q5, q6, q7, q8, q9, q10]
# bonus=[b1, b2, b3]
sum=0
# j=1

# def changeQ(i, j):
# print(i + 1, ')', bonus[j][0])
# print(bonus[j][1])
# print(bonus[j][2])
# print(bonus[j][3])
# print(bonus[j][4])
# option = input("Enter option: ")
# return option

for i in range(10):
print(i+1, ')', q[i][0])
print(q[i][1])
print(q[i][2])
print(q[i][3])
print(q[i][4])
option=input("Enter option: ")

# if((option == ("eliminate two") or ("call a friend") or ("conduct a poll"))and )
if(option==(q[i][5])):
sum=sum+(i+1)*10000
if(i == 9):
print(f"Wow you have answered all the questions \n Congratulations {name} \nYour final prize money is: ", sum)
else:
print("Now your prize money is: ", sum)

else:
print(f"Sorry {name} your option is incorrect, your final prize money is: ", sum)
break


sbndBhanu
Автор

a=int(input("enter a number betwwn 9 and 5"))
str(a)=="quit"

if str(a)=="quit":
print("ok")
elif(5<=a) or (a<9):
print("you are intellegent")
if (5>a<9):
raise ValueError("no is not betwween 5 and 9")

fact_girl
Автор

I found a mistake in your program harry bhai.. If we dont know the first question and decide to quit, we win 1 crore rupeess.. as you have used money=levels[i-1], in the first step level becomes -1 so it gives 1crore rupees if you quit in the very first step

arpanadhikari
Автор

question = ["What is your name", "what is your age", "what is your profession"]
answer = ["siddhesh", "20", "student"]
a = 0
b = 1
c = 0
for i in question:
print(i)
s = input("Enter your answer: ")
if (s == answer[a]):
c = c + (200 * b)
print("You won $", 200 * b)
a = a + 1
b = b + 1
else:
print("You loose")
break
if (c > 0):
print("Total amount you won : ", c)
else:
print("You won $0")

sul_for_lifee
Автор

Thank you so much for your time Harry bhai. This course is amazing!

abdul_moiz_