How to make quiz on python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to make quiz on python

Please tell me

27th Aug 2023, 2:09 AM
satyam
11 Answers
+ 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.')
27th Aug 2023, 5:39 PM
Vadim Sceniov
+ 5
You can search in Code Section for it and Iā€˜m sure you will find something.
27th Aug 2023, 8:12 AM
JaScript
JaScript - avatar
+ 2
Yes
27th Aug 2023, 6:12 AM
satyam
+ 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.
27th Aug 2023, 6:54 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 2
Please give me full code
27th Aug 2023, 7:07 AM
satyam
+ 2
Check this code you will get details about Sololearn https://code.sololearn.com/WN64H3evQ7U1/?ref=app
27th Aug 2023, 8:54 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 1
satyam Are you asking how to create code for creating quiz?
27th Aug 2023, 4:45 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 1
https://ibb.co/yXtVBTm Complete Python Quiz Code This was my project in 1st sem in college šŸ˜‚
27th Aug 2023, 12:57 PM
PRIYANSHU
PRIYANSHU - avatar
+ 1
https://ibb.co/0yqyN7n Output of my python quiz code
27th Aug 2023, 12:59 PM
PRIYANSHU
PRIYANSHU - avatar
+ 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.
27th Aug 2023, 8:55 PM
Chris Coder
Chris Coder - avatar