0% found this document useful (0 votes)
18 views

Create Task Program Code

Uploaded by

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

Create Task Program Code

Uploaded by

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

#This is a changing value for the quiz based on the user input

points = 0

import time
import os

#This list will store the questions


questions = ["What is the most popular dish in the United States? \nA. Salad \nB. Chicken
Tenders \nC. Cheeseburger \nD. Hotdog",
"What is the most popular dish in Costa Rica? \nA. Chicken Masala \nB. Gallo Pinto (Beans and
Rice) \nC. Pizza \nD. Tacos",
"What's the most popular dish in Italy? \nA. Pizza \nB. Spaghetti and Meatballs \nC. Chicken
Alfredo \nD. Lasagna",
"What is the most popular dish in France? \nA. Ratatouille \nB. Steak Frites (Steak and French
Fries) \nC. Crepes \nD. French Onion Soup",
"What is the most popular dish in the United Kingdom? \nA. Roast Chicken \nB. English
Breakfast \nC. Bangers and Mash \nD. Fish and Chips",
]

#This list will store the answers


answers = ["c", "b", "a", "b", "d"]

#this introduces the quiz


def intro():
name = input("Before we begin. What is your name? ")
print()

print("Now lets begin. Welcome to the Conquering Cuisine Quiz")


print()
time.sleep(3)
print("In this quiz you will be provided a country and a list of four \ndishes and you will have to
deside which one is the most popular \nin that particular country")
time.sleep(5)
print()
print("For every answer you get correct you will earn one point")
time.sleep(3)
print()
print()
answer = input("Would you like begin? \nType Y for yes and N for no: ")
print()
if answer.lower()=="y":
print("Starting quiz")
print()
elif answer.lower()=="n":
print("Come back when you wish to play")
exit()
else:
print("Invalid response")
answer = input("Would you like begin? \nType Y for yes and N for no: ")

#This function has the parameter "points" asks the user questions and gives them points for the
correct answer
def startQuiz(points):
os.system('clear')
for x in range(len(questions)):
print(questions[x])
answer = input("Pick a letter: ")
time.sleep(1)
if answer.lower() == answers[x]:
print()
print("Congrats! You earned one point.")
points = points + 1
print()
time.sleep(1)
print("You now have " + str(points) + " point/points")
else:
print()
print("You got the question wrong :(")
print()
print("You have " + str(points) + " point/points")

#This last part gives the user a reward if they met the requirments
time.sleep(2)
print("If you earned 3 or more points you win candy")
print()
print("You got " + str(points) + " point/points")
time.sleep(1)
print()
if points >= 3:
print("YOU WON THE CANDY!")
else:
print("Better luck next time")

#This is where the functions are called


intro()
startQuiz(points)

You might also like