+ 4
How to make quiz on python
Please tell me
11 Réponses
+ 2
print("Wellcome to quiz game !!")
print('NOTE: if your spelling is incorrect then it is considered as wrong answer')
score = 0
question_no = 0
playing = input('Do you want to play ? ').lower()
if playing == 'yes':
question_no += 1
ques = input(f'\n{question_no}. what does CPU stand for? ').lower()
if ques == 'central processing unit':
score +=1
print('correct! you got 1 point')
else:
print('Incorrect!')
print(f'current answer is --> central processing unit')
# ------1
question_no += 1
ques = input(f'\n{question_no}. what does GPU stand for? ').lower()
if ques == 'graphics processing unit':
score +=1
print('correct! you got 1 point')
else:
print('Incorrect!')
print(f'current answer is --> graphics processing unit')
# -----2
question_no += 1
ques = input(f'\n{question_no}. what does RAM stand for? ').lower()
if ques == 'random access memory':
score +=1
print('correct! you got 1 point')
else:
print('Incorrect!')
print(f'current answer is --> random access memory')
# -----3
question_no += 1
ques = input(f'\n{question_no}. what does PSU stand for? ').lower()
if ques == 'power supply unit':
score +=1
print('correct! you got 1 point')
else:
print('Incorrect!')
print(f'current answer is --> power supply unit')
else:
print('thank you you are out of a game.')
quit()
print(f'\nnumber of question is {question_no}')
print(f'your score is {score}')
try:
percentage = (score *100)/question_no
except ZeroDivisionError:
print('0% quetions are correct')
print(f'{percentage}% questions are correct.')
+ 5
You can search in Code Section for it and I‘m sure you will find something.
+ 2
Yes
+ 2
-> Use print() for welcome to quiz and also for correct or incorrect answer.
-> input() for asking question
-> Create variable for points or score of an user.
+ 2
Please give me full code
+ 2
Create you will get 2 options
Code and Discuss
In Code section search the code only for reference.
https://code.sololearn.com/cJp9j0Db5sgT/?ref=app
https://code.sololearn.com/cKPCq483QOay/?ref=app
https://code.sololearn.com/cuR5JUgrj4RF/?ref=app
https://code.sololearn.com/cMp9kyUSPF2f/?ref=app
https://code.sololearn.com/crcNa20PAufQ/?ref=app
+ 2
Check this code you will get details about Sololearn
https://code.sololearn.com/WN64H3evQ7U1/?ref=app
+ 1
satyam Are you asking how to create code for creating quiz?
+ 1
https://ibb.co/yXtVBTm
Complete Python Quiz Code
This was my project in 1st sem in college 😂
+ 1
https://ibb.co/0yqyN7n
Output of my python quiz code
+ 1
If you are new to Python, I recommend the introductory course from Sololearn. Completing it will provide the foundation of skills needed to create a quiz using Python.