Skip to content

Commit 9afaccd

Browse files
authored
Create hacktoberfest-quiz.py
A simple Hacktoberfest 2022 quiz. Feel free to add more questions or improve the script.
1 parent c88895a commit 9afaccd

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
print('Welcome to the Hacktoberfest 2022 Quiz')
2+
answer=input('Are you ready to play the Quiz ? (yes/no) :')
3+
score=0
4+
total_questions=3
5+
6+
if answer.lower()=='yes':
7+
answer=input('Question 1: What programming language was this quiz created in?')
8+
if answer.lower()=='python':
9+
score += 1
10+
print('correct')
11+
else:
12+
print('Wrong Answer :(')
13+
14+
15+
answer=input('Question 2: Is one of the values of Hacktoberfest 2022 "EVERYONE IS WELCOME" ? ')
16+
if answer.lower()=='yes':
17+
score += 1
18+
print('correct')
19+
else:
20+
print('Wrong Answer :(')
21+
22+
answer=input('Question 3: Does Hacktoberfest end on December 31?')
23+
if answer.lower()=='no':
24+
score += 1
25+
print('correct')
26+
else:
27+
print('Wrong Answer :(')
28+
29+
print('Thankyou for Playing the Hacktoberfest quiz game, you attempted',score,"questions correctly!")
30+
mark=(score/total_questions)*100
31+
print('Marks obtained:',mark)
32+
print('BYE!')

0 commit comments

Comments
 (0)