You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
qaList= [QA("Where is Minsk?", "in Belarus", ["in Russia", "such a city doesn't exist"]),
10
-
QA("What is the capital of Australia?", "Canberra", ["Sydney", "New York", "Australia doesn't exist"]),
11
-
QA("Which of the following is not on Earth?", "Sea of Tranquility", ["Mediterranean Sea", "Baltic Sea", "North Sea"]),
12
-
QA("Which of the following is not a continent?", "Arctica", ["Antarctica", "America"]),
13
-
QA("Which of the following is not an African country?", "Malaysia", ["Madagascar", "Djibouti", "South Africa", "Zimbabwe"])]
9
+
qaList= [QA("What is (void*)0?", "Representation of NULL pointer", ["Representation of void pointer", "Error"]),
10
+
QA("In which header file is the NULL macro defined?", "stdio.h and stddef.h", ["stdio.h", "stddef.h", "math.h"]),
11
+
QA("A pointer is?", "A variable that stores address of other variable", ["A keyword used to create variables", "A variable that stores address of an instruction", "All of the above"]),
12
+
QA("The operator used to get value at address stored in a pointer variable is?", "*", ["&", "&&"]),
13
+
QA("The keyword used to transfer control from a function back to the calling function is?", "return", ["goto", "switch", "getch"])]
14
14
15
15
corrCount=0
16
16
random.shuffle(qaList)
17
17
forqaIteminqaList:
18
18
print(qaItem.question)
19
-
print("Possible answers are:")
19
+
print("---------------------------")
20
20
possible=qaItem.otherAnsw+ [qaItem.corrAnsw] # square brackets turn correct answer into list for concatenating with other list
21
21
random.shuffle(possible)
22
22
count=0# list indexes start at 0 in python
23
23
whilecount<len(possible):
24
24
print(str(count+1) +": "+possible[count])
25
25
count+=1
26
+
print("---------------------------")
26
27
print("Please enter the number of your answer:")
27
28
userAnsw=input()
28
29
whilenotuserAnsw.isdigit():
29
-
print("That was not a number. Please enter the number of your answer:")
30
+
print("That is not a number. Please enter the number of your answer:")
0 commit comments