Python quiz game 💯

preview_player
Показать описание
python quiz game project tutorial example explained

#python #quiz #game

# -------------------------
def new_game():

guesses = []
correct_guesses = 0
question_num = 1

for key in questions:
print("-------------------------")
print(key)
for i in options[question_num-1]:
print(i)
guess = input("Enter (A, B, C, or D): ")

question_num += 1

display_score(correct_guesses, guesses)

# -------------------------
def check_answer(answer, guess):

if answer == guess:
print("CORRECT!")
return 1
else:
print("WRONG!")
return 0

# -------------------------
def display_score(correct_guesses, guesses):
print("-------------------------")
print("RESULTS")
print("-------------------------")

print("Answers: ", end="")
for i in questions:
print()

print("Guesses: ", end="")
for i in guesses:
print(i, end=" ")
print()

score = int((correct_guesses/len(questions))*100)
print("Your score is: "+str(score)+"%")

# -------------------------
def play_again():

response = input("Do you want to play again? (yes or no): ")

if response == "YES":
return True
else:
return False
# -------------------------

questions = {
"Who created Python?: ": "A",
"What year was Python created?: ": "B",
"Python is tributed to which comedy group?: ": "C",
"Is the Earth round?: ": "A"
}

options = [["A. Guido van Rossum", "B. Elon Musk", "C. Bill Gates", "D. Mark Zuckerburg"],
["A. 1989", "B. 1991", "C. 2000", "D. 2016"],
["A. Lonely Island", "B. Smosh", "C. Monty Python", "D. SNL"],
["A. True","B. False", "C. sometimes", "D. What's Earth?"]]

new_game()

while play_again():
new_game()

print("Byeeeeee!")

# -------------------------

Bro Code merch store 👟 :
===========================================================
===========================================================

music credits 🎼 :
===========================================================
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
===========================================================
Рекомендации по теме
Комментарии
Автор

This video is really amazing and help me a lot in exploring the python.

JonBraydenCodes
Автор

Thank you so much. I'm taking a python class right now in school and I'm pretty sure you're videos will teach me more then my professor will. I hope I can master this

archerxx
Автор

I love your clear, concise explanation and code. As usual, another great video!

davidmcdade
Автор

Thank you that was clear and easy to understand.

francismannion
Автор

Sir,
I love this way to teach in detail, each and every aspect of quiz game❤❤❤❤❤

MuhammadArshad-vvxx
Автор

honestly thank you the other video about quizzes didn't work but yours did

Uhmatmcr
Автор

Great video I’m doing my Create task right now This is my inspiration for my game.

fazeasta
Автор

Finally understood this code, even though I think there are more efficient or easier ways to write this project since not all the connections between elements were clear. but it is nice to see this so I can challenge myself and find another way. Good stuff thanks Bro. 👌

davidcalebpaterson
Автор

Keep the videos just like this, you explain very good

Verzach
Автор

great tutorial !! that was tough. Thanks

piotrkopcewicz
Автор

Commenting to beat the youtube algorithm, I wanna thank you, i paid $30 for a shitty course and couldn understand shit, you made everything clear thank you

CarlJohnson-drtv
Автор

I'm new to Python, but have done basic programming in MATLAB. This was very helpful for understanding the syntax of Python covering quite a few basic concepts - thank you!

miles_walker
Автор

YOU ARE A LIFE SAVER THANK YOU SO MUCH

yourroboticfriendexe
Автор

Thanks, ive gone from your Java tutorials now to Python. Loving it

lastwaveundergroundsaviour
Автор

Bro, that one was superb!!! Congrats!!!

yiorgoskatopodis
Автор

Brother you are a saviour. We had to make a project on pandas and everyone were doing the same old managing project but me and my friend came across your quiz.
We took the main program from your video and then modified it and made it a nice descriptive quiz with different sections and emojis and also made graphs.
Tomorrow are my practicals and I am again seeing your video so that I can explain it better to the examiner

Again thank you so so much🙆

henal
Автор

Thanks! Helped a lot to understand a lot of things!

RhombusDaily
welcome to shbcf.ru