Python Report Final1
Python Report Final1
1
CERTIFICATE
This is to certify that the lab project report on “ QUIZ USING BASIC PYTHON” in
python submitted by K.SURENDER BABU (21311A04G5) is a record of boanfide work
carried out by them in the academic year 2023-24 under our guidance and evaluation.
2
Declaration and Acknowledgement
We hereby declare that the work described to “QUIZ USING BASIC PYTHON” submitted
by us is the work on our own effort and has not been submitted elsewhere.
We are thankful to Dr. Latha sahukar madam, Assistant Professor, ECE Department,
Sreenidhi Institute of Science and Technology, Yamnampet, Ghatkesar, for providing the
initiative to this report and giving us valuable and timely suggestions for our work.
We convey our sincere thanks to Dr. S. P. V. Subba Rao sir, Head of the Department (ECE),
Sreenidhi Institute of Science and Technology, Yamnampet, Ghatkesar, for his kind
cooperation in the completion of this work.
We even convey our sincere thanks to Prof. C. V. Tomy sir, Executive Director and Dr. T.
Ch.
Siva Reddy sir, Principal, Sreenidhi Institute of Science and Technology, Yamnampet,
Ghatkesar, for their kind cooperation in the completion of the lab project report on
generating QR code using Python.
Finally, we extend our gratitude to all teachers, non-teaching staff, friends and family, who
helped us complete this project directly or indirectly.
Place:Hyderabad
Submitted by:K.SURENDER
3
INDEX
1 Description 6
2 Program 6
4 Explanation 12
5 Example model 13
7 Limitations 14
8 Future advancements 14
9 Conclusion 14
10 References 15
4
DESCRIPTION
This project is all about a quiz which is developed using basic python programming like if, else
statements. This is the program of quiz game which test our IQ. First statement for greeting
(Welcome). Asking for interest if player text "yes" i.e., only start. If player text "no" i.e., quit &
end the game. Initial score is equal to zero before starting answering the given questions. Display
questions from 1 to 10. For every question this python program automatically checks if the player
entered answer is correct or not if it corrects i.e., display correct else display in correct. If and only
if player answer is correct i.e., only score will be incremented else no change in score (no-negative
percentage). After completing all the 10 questions it displays how many questions do you attempt
correctly out of 10 and also display over-all percentage. Final statement ends with thanks greeting.
5
PROGRAM: -
def welcome_message():
def play_game():
if gaming.lower() != 'yes':
quit()
user_answer = input(question).lower() if
user_answer == correct_answer:
print("CORRECT\n")
return 1
else:
print("IN-CORRECT\n")
return 0
def display_result(score):
LIBRARY FUNCTION:
import quiz_library
def main():
quiz_library.welcome_message()
quiz_library.play_game()
6
score = 0 # initial score
score += quiz_library.ask_question("2. What will you actually find at the end of every
rainbow? (Single letter) \n ", "w")
score += quiz_library.ask_question("3. What belongs to you but gets used by everyone else
more than you? (Think) \n", "name")
score += quiz_library.ask_question("4. What goes up as soon as the rain comes down? (**)
\n", "umbrella")
score += quiz_library.ask_question("9. How many sides are there in a circle? (**) \n ",
"0")
score += quiz_library.ask_question("10. There are 5 apples in the bag. How many do you
have if you take away three apples? (number)\n ", "2")
quiz_library.display_result(score)
if __name__ == "__main__":
main()
7
OUTPUT: -
yes
1.python in Telugu? (Ans: Koṇḍaciluva (is it correct i.e., type yes else no)
yes
CORRECT
2. What will you actually find at the end of every rainbow? (Single letter)
CORRECT
3.What belongs to you but gets used by everyone else more than you? (Think)
name
CORRECT
CORRECT
mushroom
CORRECT
8
6.Where is an ocean with no water? (^^ap)
map
CORRECT
CORRECT
yes
CORRECT
CORRECT
10.There are 5 apples in the bag. How many do you have if you take away three apples?
(number)
CORRECT
9
FLOWCHART:
+------------------+
| Start |
+------------------+
+----------+
| Display |
| Welcome |
| Message |
+----------+
+-------------+
| Ask User |
| to Play? |
+-------------+
10
+------------------+
| User's Choice |
| (yes/no) |
+------------------+
No | Yes
+---------+
| Quit |
+---------+
+---------------+
| Initialize |
| Score |
+---------------+
+---------------+
| Loop over |
| Questions |
+---------------+
V +---------------+
| Ask Question |
+---------------+
11
|
+---------------+
| Check Answer |
+---------------+
+---------------+
| Display |
| Result |
+---------------+
+----------------+
| Loop Complete |
+----------------+
+----------------+
| Display |
| Thank-You |
+----------------+
V +------------------+
| End |
12
EXPLAINATION: -
13
EXAMPLE MODEL: -
14
STEPS FOR EXECUTING THE PROGRAM
15
LIMITATION
• The solutions to the questions in the quiz may be not actually know to the users.
• The programmer needs to have code the program without any syntax or logical errors.
• The users have no option to clear their response once they have submitted or entered
the answer to the question.
• The users cannot see the remaining questions without completing the recent question.
• The previous answers cannot be changed.
16
FUTURE ADVANCEMENTS
• Make it multiplayer - Try modifying this game so that more than one player can
enjoy this game at once. You can do this by simply adding an additional for loop
which will contain the names of the players and score of each player is stored
separately. The player with the highest score will win the game.
• Use MCQ format - Not just quiz, you can also use it conduct MCQ tests. All you
have to do is modify the print function to print the multiple answers and the player
will have to guess the right answer.
• Use an API - Make use of an interesting API to automatically fetch questions from
the web so you do not have to get into the hassle of creating the questions and
answers on your own.
17
CONCLUSION
From this project one can understand the basic operations used in the python programming.
Using those basic we can build a program. This is the project is basically a basic quiz which
is developed using if, else conditions and doing mathematical calculations for the average
score.
18
REFERENCES
Real Python. (2022, November 11). Build a Quiz Application With Python.
https://realpython.com/python-quiz-application/
GeeksforGeeks. (2022, April 20). Python - MCQ Quiz Game using Tkinter.
https://www.geeksforgeeks.org/python-mcq-quiz-game-using-tkinter/
19