You, in turn, might end up getting hurt or bullied.
name = input("What's your name? ")
print("Hello " + name + ", welcome to my quiz!")
score = 0
di = {"qustion1": "answer1", "qustion2": "answer2", "qustion3": "answer3", "qustion4": "answer4", "qustion5": "answer5", "qustion6": "answer6",
"qustion7": "answer7", "qustion8": "answer8", "qustion9": "answer9", "qustion10": "answer10"}
for x in di:
user_answer = input(x+" ")
if user_answer == di[x]:
print("That's correct!")
score += 1
else:
print("The correct answer is " + str(di[x]))
print("You got "+str(score)+" out of 10!")
I iterated through a dictionary with the questions and answers as the keys and values respectively. I hope this helps!
I think it’s O Mary Stevenson Cassatt! Good luck
Answer:
The output of the given code as follows:
<u>Output:
</u>
1122
Explanation:
In the given java code the two for loop is defined, which can be described as follows:
- In the first loop, a"loop" variable is used, which starts from 1 and ends when the value of loop is less than 3, inside the loop a print function is used, that print value 1.
- In the next step, another for loop is declared, inside the loop a variable "loop2" variable is used, that's working is the same as the above loop, but in this loop, it will print a value, that is 2.