from random import randint
#Variables
score = 0
playing = True
#Define a list of possible words and definitions
wordDict = {
0: "Argument",
1: "List",
2: "Index",
3: "Block",
4: "Break",
5: "Class",
6: "Bug",
7: "Code",
8: "Python",
9: "Def",
10: "Dictionary"
}
defDict = {
0: "A value that is passed between programs, subroutines or functions",
1: "Used to hold multiple values under linear indexes",
2: "Where a value is in a list/array",
3: "Structure of source code which is grouped together",
4: "Used to stop a loop",
5: "Template definition of the methods and variables in a particular kind of object",
6: "A mistake in a program",
7: "Program instructions",
8: "Coding language that this is written in",
9: "Used to define a method",
10: "Used to hold multiple values under nonlinear indexes"
}
while playing:
index = randint(0, 10)
print("Which word matches this definition or example: \n" + defDict.get(index))
guess = input()
if(guess == wordDict.get(index)):
score+=1
print("Correct! Score: " + str(score))
else:
print("Incorrect! The correct answer was " + wordDict.get(index) + ", Final score: " + str(score))
playing = False