Create a QUIZ GAME with Python 💯

preview_player
Показать описание
#python #tutorial #course

# Python quiz game

questions = ("How many elements are in the periodic table?: ",
"Which animal lays the largest eggs?: ",
"What is the most abundant gas in Earth's atmosphere?: ",
"How many bones are in the human body?: ",
"Which planet in the solar system is the hottest?: ")

options = (("A. 116", "B. 117", "C. 118", "D. 119"),
("A. Whale", "B. Crocodile", "C. Elephant", "D. Ostrich"),
("A. Nitrogen", "B. Oxygen", "C. Carbon-Dioxide", "D. Hydrogen"),
("A. 206", "B. 207", "C. 208", "D. 209"),
("A. Mercury", "B. Venus", "C. Earth", "D. Mars"))

answers = ("C", "D", "A", "A", "B")
guesses = []
score = 0
question_num = 0

for question in questions:
print("----------------------")
print(question)
for option in options[question_num]:
print(option)

guess = input("Enter (A, B, C, D): ").upper()
if guess == answers[question_num]:
score += 1
print("CORRECT!")
else:
print("INCORRECT!")
print(f"{answers[question_num]} is the correct answer")
question_num += 1

print("----------------------")
print(" RESULTS ")
print("----------------------")

print("answers: ", end="")
for answer in answers:
print(answer, end=" ")
print()

print("guesses: ", end="")
for guess in guesses:
print(guess, end=" ")
print()

score = int(score / len(questions) * 100)
print(f"Your score is: {score}%")
Рекомендации по теме
Комментарии
Автор

questions = ("How many elements are in the periodic table?: ",
"Which animal lays the largest eggs?: ",
"What is the most abundant gas in Earth's atmosphere?: ",
"How many bones are in the human body?: ",
"Which planet in the solar system is the hottest?: ")

options = (("A. 116", "B. 117", "C. 118", "D. 119"),
("A. Whale", "B. Crocodile", "C. Elephant", "D. Ostrich"),
("A. Nitrogen", "B. Oxygen", "C. Carbon-Dioxide", "D. Hydrogen"),
("A. 206", "B. 207", "C. 208", "D. 209"),
("A. Mercury", "B. Venus", "C. Earth", "D. Mars"))

answers = ("C", "D", "A", "A", "B")
guesses = []
score = 0
question_num = 0

for question in questions:

print(question)
for option in options[question_num]:
print(option)

guess = input("Enter (A, B, C, D): ").upper()
guesses.append(guess)
if guess == answers[question_num]:
score += 1
print("CORRECT!")
else:
print("INCORRECT!")
is the correct answer")
question_num += 1


print(" RESULTS ")


print("answers: ", end="")
for answer in answers:
print(answer, end=" ")
print()

print("guesses: ", end="")
for guess in guesses:
print(guess, end=" ")
print()

score = int(score / len(questions) * 100)
print(f"Your score is: {score}%")

BroCodez
Автор

this was fun as heck to follow tysm you literally are one of the reasons i discovered that i love coding and cs but they were presented to me badly by uni and some people who code or wtv .. i really appreciate u and i appreciate any instructor or just any coder who keep it chill and doesnt take things too seriously or make it seem complex when it literally isnt

idontstudyforamidterm
Автор

You are truly awesome, 👌
Please make this quiz game with gui 🙏

mukesh_awale
Автор

I appreciate how easy you make it to understand these concepts - thanks!!

starwyvern
Автор

Hello! You are so cool to these videos, they are really useful and I can learn so much about coding and fun stuff. I'm fairly new to this channel, so I'm not sure if I can ask you something: Could you do a Battleship game in Java? Or is it hard to do? It's so fun to watch you write these games in different programming languages.
Well, anyways thank you for these guide videos, I'll be sure to watch them all(already watched a few). And wish you all the best!!
Your videos always makes me want to eat pizza🤤, I don't know why 😁

mayukikomatsu
Автор

The video os awesome, and ill continue to enjoy your content, but the channel name is the greatest idea EVER 🎉

greivinvenegas
Автор

Nice, I'm early to watch Giga Chad coding ☕🗿

craftrumzen
Автор

This is so dope. Thank you. I want to create a Buzzfeed-like game for a client. This is a great template to start with. Thank you.

ntombi-yensimbinarrates
Автор

WOW! IMPRESSIVE! I WILL HAVE TO RESTUDY IN DEPTH THE LOGICS OF YOUR CODE, BUT I AM REALLY IMPRESSED BY THE ELEGANCE OF YOUR PROGRAM!

francisjacquart
Автор

Hey man, great work. You got a like and a subscriber right away.

PedroRodriguez-fvsc
Автор

Hello, can you please introduct us to a advanced c tutorial? Like teach us header files, how to make them, how they work. It would be cool for us.

mnonom_yt
Автор

Thank you so much Bro Code. Can you make some python projects for beginners . Please

zabehullahalizadeh
Автор

This video was really good. I learned a lot. thanks

alooy
Автор

this is gonna be so useful im glad i found this channel
bc of this channel my brother also got into coding

DiamondMan
Автор

Thanks, Now I Can Make A Python Quiz Test. You're And Awesome Coder.😎👍

Philippines
Автор

sir, you are godsent! thank you for your videos, you make it so easy to understand.

kszoknyik
Автор

Every tutorial is usefull. You have made so many videos in Python .But make a GUI image viewer in Python.

kandukurisrinivasarao
Автор

Brother this thing I wanted to create in Java but I can't because I have to learn applets but by watching ur python tutorial it's easy to build in python Thank you so much for your help .

prabuddhapal
Автор

I would love to see a tutorial on web scraping

iohanstefanjourney
Автор

You can also use a dict to contain each question, its choices, answer and its index all at once in each index so its like,

questions = {
question_01 : {question, choices, answer},
question_02 :
}

It would make anything else easier later.

--__--