-
Notifications
You must be signed in to change notification settings - Fork 0
/
Quiz_game.py
89 lines (73 loc) · 2.08 KB
/
Quiz_game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
print("Welcome to my computer quiz!")
playing = input("Do you want to play ? ")
if playing.lower() != "yes" :
quit()
score = 0
answer = input("What does CPU stand for? ")
if answer.lower() == "central processing unit" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what is the keyword used to define a function in python? ")
if answer.lower() == "def" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what symbol is used to start a comment in python? ")
if answer.lower() == "#" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("which method is used to add an element to the end of a list? ")
if answer.lower() == "append" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what is the correct file extension for python files? ")
if answer.lower() == "py" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what is the output of print(2 ** 3)? ")
if answer == "8" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what function is used to get the length of a list in python? ")
if answer.lower() == "len" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what is the output of print(10 // 3)? ")
if answer == "3" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("what is the output of print(len(""hello world""))? ")
if answer == "11" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("What GPU stand for? ")
if answer.lower() == "graphics processing unit" :
print("Correct!")
score += 1
else:
print("Incorrect!")
answer = input("What does RAM stand for? ")
if answer.lower() == "random access memory" :
print("Correct!")
score += 1
else:
print("Incorrect!")
print("You got " + str(score) + " questions correct!")
print("You got " + str(round((score / 11) * 100, 1)) + ("%."))