# Make this code work. It has to have three guesses, then calculate the percent of the right and wrong guesses

## Question:

Make this code work. It has to have three guesses, then calculate the percent of the right and wrong guesses right_answer = 0 # Initialise variable to store correct answers.

print("What is the capital of Prince Edward Island ?")

for i in range(1, 4):

answer = input("Guess 1 :")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

if answer == "Charlottetown": # Check if answer is as expected.

print ("Correct!")

break

print("What is the capital of Newfoundland ?")

for i in range(1, 4):

answer = input("Guess 1 :")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

if answer == "St. John's": # Check if answer is as expected.

print("Correct")

break

print("What is the capital of Nova Scotia ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Halifax": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of New Brunswick ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Fredericton": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Quebec ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Quebec City": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Ontario ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Toronto": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Manitoba ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Winnipeg": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Saskatchewan ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Regina": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Alberta ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Edmonton": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of British Columbia ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Victoria": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Northern West territories ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Yellowknife": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Yukon ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Whitehorse": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("What is the capital of Nunavut ?")

for i in range(1, 4):

answer = input("Guess 1 :")

if answer == "Iqaluit": # Check if answer is as expected.

print("Correct")

answer = input("Guess 2 :")

answer = input("Guess 3 :")

print("Correct!")

break

print("You got", right_answer, "right and made", 10 - right_answer,

"wrong guesses.") # Print count of correct and wrong guesses.

print("Your total score is", (right_answer / 10) * 100, "%") # Print total score.

**Related Book For**

**View Solution**

**Cannot find your solution?**

**Posted Date:**September 01, 2023 02:31:04