0% found this document useful (0 votes)
9 views6 pages

Quiz Game Coding in Python

The document contains a Python quiz game with three modules: Anagram, World, and Mental Maths, where players answer questions to earn points. Each module has specific questions and scoring rules, with penalties for incorrect answers. Additionally, there is a turtle graphics section that demonstrates how to draw a square using the Python turtle library.

Uploaded by

yashira.kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Quiz Game Coding in Python

The document contains a Python quiz game with three modules: Anagram, World, and Mental Maths, where players answer questions to earn points. Each module has specific questions and scoring rules, with penalties for incorrect answers. Additionally, there is a turtle graphics section that demonstrates how to draw a square using the Python turtle library.

Uploaded by

yashira.kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Quiz Game coding in Python:

#angram module

def anagram():

points=0

print("Welcome to anagram room")

print("I am going to give you two anagram to solve")

print("Enter your answer in Uppercase letters only")

ans1=input("What kind of fruit PEPLA?")

if ans1=="APPLE":

print("Well done. You have gained 20 points.")

points=points+20

else:

print("Sorry wrong answer. Lose 5 points")

points=points-5

print("Enter your answer in lowercase letters only")

ans2=input("What kind of flower minjaes")

if ans2=="jasmine":

print("Well done. You scored 20 points")

points=points+20

else:

print("Sorry wrong answer. Lose 5 points")

points=point-5

print("Your total points=",points)

# World room module

def world():

print("Welcome to World room")

points=0

print("you have been transported to portugal")

print("Please type answers in capital letters only")


ans1=input("what is the capital city of Portugal?")

ans2=input("What is the currency used in Portugal?")

if ans1=="LISBON" and ans2=="EURO":

print("Well done: You have gained 30 points")

points=points+30

elif ans1=="LISBON" or ans2=="EURO":

print("One answer is correct. You have gained 15 points.")

points=points+15

else:

print("Sorry wrong answers Lose 5 points.")

points=points-5

print("you have been transported to USA")

print("Please type answers in capital letters only")

ans1=input("what is the capital city of USA?")

ans2=input("What is the currency used in USA?")

if ans1=="WASHINGTON" and ans2=="DOLLAR":

print("Well done: You have gained 30 points")

points=points+30

elif ans1=="WASHINGTON" or ans2=="DOLLAR":

print("One answer is correct. You have gained 15 points.")

points=points+15

else:

print("Sorry wrong answers Lose 5 points.")

points=points-5

print("Your total points=",points)

#Mental maths module

def mentalmaths():

points=0

print("Welcome to Mental Maths room")


print("you will be askesd a mental arithmetic questions:")

num1=random.randint(1,10)

num2=random.randint(1,10)

crctanswer=num1+num2

print("What is", num1,"plus", num2)

ans1=int(input("Enter your answer here:"))

if ans1==crctanswer:

print("Well done you have gained 20 points")

points=points+20

else:

print("Sorry that is wrong answer. you lose 5 points")

points=points-5

num1=random.randint(1,10)

num2=random.randint(1,10)

crctanswer=num1+num2

print("What is", num1,"*", num2)

ans1=int(input("Enter your answer here:"))

if ans1==crctanswer:

print("Well done you have gained 20 points")

points=points+20

else:

print("Sorry that is wrong answer. you lose 5 points")

points=points-5

print("Your total points=",points)

#Game Welcome module

def welcome():

print("Welcome to my program")

print(name,"Please choose a puzzle room to enter.")

print("1. The Anagram Room\n 2. The World Room\n 3. The Mental Maths
room ")

choice=input("Enter your choice 1/2/3 now:")

if choice == '1':

score=anagram()

elif choice=='2':

score=world()

else:

score=mentalmaths()

import random

print(" WELCOME TO THE QUIZ GAME")

name=input("enter your name:")

age=int(input("enter your age:"))

minage=8

if age<8:

print("sorry you are too young to play this game ")

else:

print("Let the game begin")

welcome()

Write a Python Program to draw a square using Python turtle library

import turtle

turtle.pensize(3)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)
turtle.left(90)

Quiz Game coding in Python:

#angram module

def anagram():

points=0

print("Welcome to anagram room")

print("I am going to give you two anagram to solve")

print("Enter your answer in Uppercase letters only")

ans1=input("What kind of fruit PEPLA?")

if ans1=="APPLE":

print("Well done. You have gained 20 points.")

points=points+20

else:

print("Sorry wrong answer. Lose 5 points")

points=points-5

print("Enter your answer in lowercase letters only")

ans2=input("What kind of flower minjaes")

if ans2=="jasmine":

print("Well done. You scored 20 points")

points=points+20

else:

print("Sorry wrong answer. Lose 5 points")

points=point-5

print("Your total points=",points)

# World room module

def world():

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy