This is Riyaz's project website
hello friends, please click the link given and download the .py file in the below to enjoy the game
Assignment: Riyaz's Quiz Game
Objective:
Create a basic quiz game using Python. The game will ask the player a few questions, and the player will answer them. The game will give feedback based on whether the answer is correct or not.
How the Game Works:
. Starting the Game:
- The game will first ask, "Do you want to play?".
- If the player answers "Yes", the game starts.
- If the player answers "No", the game ends.
Questions:
- The game will ask the player several questions.
- For each question, the player can type an answer.
- If the answer is correct, the game will say "Correct!". If the answer is wrong, it will say "Oops!".
Example Questions:
- What is the common color of an apple? (Answer: Red)
- What is our national animal? (Answer: Tiger)
- How many 'o's are there in this question? (Answer: Five or 5)
What You Learn:
- Using input(): This function is used to get the player's answers.
- Using if and else: The game checks if the player's answer matches the correct answer.
- Using .lower(): This makes the game ignore case, so "red" and "Red" are both correct.
Sample Code:
user = input("Do you want to play (Yes or No)? ")
if user.lower() == "yes":
print("The game starts!")
question = input("What is a common color of an apple? ")
if question.lower() == "red":
print("Correct!")
else:
print("Oops!")
print("Thanks for playing!")
else:
quit()
This version keeps everything simple and clear. The user can easily understand how the game works and the basic coding concepts behind it.
Thank you all