Write a Python program which will quiz a user about the capital city of each province...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program which will quiz a user about the capital city of each province in Canada. The program should do the following: • • • Allow only 3 guesses for each province. Display the guess number Quiz all 10 provinces Output a message, when user guesses correctly. Sample output screen: What is the capital of Newfoundland? Guess 1: Guess 2: Guess 3: ...St. John's ...St. John ...St. Johns Correct! What is the capital of Prince Edward Island? Guess 1: *** After you completed the quiz for all 10 provinces, then modify the program so that it will display the number of right and wrong answers at the end of the quiz. It will also display the users score as a percentage mark (e.g., 90%) Bonus marks given if you add the Canadian territories. Sample output screen: Correct! What is the capital of Saskatchewan? Guess 1: ... Regina Correct! What is the capital of Alberta? Guess 1: ...Edmonton Correct! What is the capital of British Columbia? Guess 1: ...Victoria Correct! You got 7 right and made 3 wrong guesses. Your total score is 70.0% >>> import random num1 = random.randint(1, num2 = random.randint(1, 5) 5) guess = int(input("Enter the first number randomly generated")) while guess != num1: print("your guess is wrong") guess = int(input("Enter the first number randomly generated")) guess2 = int(input("Enter the second number randomly generated")) while guess2 != num2: print("your guess is wrong") guess2 = int(input("Enter the second number randomly generated")) print("Good you guessed both numbers correctly") def address(): print("12 Shakespere Rd") print("New Jersey") def no_response(): print("It's ok") print("I don't know it off by heart") answer=input("Do you want my adress?") if answer == "yes": address() elif answer == "no" no_response() else: print("I dont understand") 2020 Write a Python program which will quiz a user about the capital city of each province in Canada. The program should do the following: • • • Allow only 3 guesses for each province. Display the guess number Quiz all 10 provinces Output a message, when user guesses correctly. Sample output screen: What is the capital of Newfoundland? Guess 1: Guess 2: Guess 3: ...St. John's ...St. John ...St. Johns Correct! What is the capital of Prince Edward Island? Guess 1: *** After you completed the quiz for all 10 provinces, then modify the program so that it will display the number of right and wrong answers at the end of the quiz. It will also display the users score as a percentage mark (e.g., 90%) Bonus marks given if you add the Canadian territories. Sample output screen: Correct! What is the capital of Saskatchewan? Guess 1: ... Regina Correct! What is the capital of Alberta? Guess 1: ...Edmonton Correct! What is the capital of British Columbia? Guess 1: ...Victoria Correct! You got 7 right and made 3 wrong guesses. Your total score is 70.0% >>> import random num1 = random.randint(1, num2 = random.randint(1, 5) 5) guess = int(input("Enter the first number randomly generated")) while guess != num1: print("your guess is wrong") guess = int(input("Enter the first number randomly generated")) guess2 = int(input("Enter the second number randomly generated")) while guess2 != num2: print("your guess is wrong") guess2 = int(input("Enter the second number randomly generated")) print("Good you guessed both numbers correctly") def address(): print("12 Shakespere Rd") print("New Jersey") def no_response(): print("It's ok") print("I don't know it off by heart") answer=input("Do you want my adress?") if answer == "yes": address() elif answer == "no" no_response() else: print("I dont understand") 2020
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that quizzes the user about the capital cities of Canadian provinces and then ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
We can describe a diagonal wave as a superposition of vertically and horizontally polarized light. How do you write this superposition using the bra-ket notation? How is this superposition...
-
Reviewing your corporation's statement of cash flows: what do you learn about your SEC 10-K company as you view the four financial statements together? Use course resources to explain the purpose of...
-
What am I required to do in this assignment? Shared Power is an information system to help tradesmen share expensive and specialist tools rather than buying them themselves. Registered owners add...
-
During the year ended 30 June 2019 XYZ Pty Limited, a resident Australian private company (non BRE), received a franked dividend of $10,800 with $3,200 of attached franking credits. XYZ Pty Limited...
-
Archer Construction Company began work on a $420,000 construction contract in 2010. During 2010, Archer incurred costs of $278,000, billed its customer for $215,000, and collected $175,000. At...
-
A space capsule weighing 5000 pounds is propelled to an altitude of 200 miles above the surface of the earth. How much work is done against the force of gravity? Assume that the earth is a sphere of...
-
Selected accounts from the trial balance as at 30 June 2026 of the partnership of Delta, Alpha and Omega are as follows. End-of-period adjustments for the financial year ended 30 June 2026 have yet...
-
The Polishing Department of Estaban Manufacturing Company has the following production and manufacturing cost data for September. Materials are entered at the beginning of the process. Production:...
-
8. Money and Foreign exchange markets in Frankfurt and NY are very efficient and reflect the following information Spot Ex rate 1-yr TB rate a) $0.9000/Euro London 6.5% Unknown NY $0.9000/Euro 3.20%...
-
A wet t-shirt hung on a hanger has a total surface area of about 0.6 m2 . It loses water as follows: time (min) 0 5 33 45 weight (g) 661 640 580 553 Calculate the flux of water vapor away from the...
-
The interest charged on a $252000 note payable, at the rate of 6%, on a 90-day note would be (Use 360 days for calculation.) a) $3800 b) $3750 c) $3780 d) $3870
-
The following diagram shows two reference variables pointing to the same Bunny object in memory. The reference variable myBunny is of type Bunny, while unknownBunny is a valid but unknown data type....
-
The author of this method forgot to include the data type. Which of the following reference types can best fill in the blank to complete this method? A. String B. StringBuilder C. Both D. Neither...
-
Given the file Magnet.java shown, which of the marked lines can you independently insert the line var color; into and still have the code compile? // line al public class Magnet { // line a2 public...
-
Which of the following properties of an enum can be marked abstract? A. The enum type definition B. An enum method C. An enum value D. An enum constructor E. None of the above
-
Given the following code, which lines when placed independently in the blank allow the code to compile and print bounce? (Choose two.) A. var new = TennisBall; B. TennisBall(); C. var var = new...
-
Find the coordinate vector [x] of x relative to the given basis B = 1 --[-]>-[-|--[-2] b = 5 b 3 [X]B 18 (Simplify your answers.) X= 5 12 {b,b}.
-
Heineken N.V., a global brewer based in the Netherlands, reports the following balance sheet accounts for the year ended December 31, 2016 (euros in millions). Prepare the balance sheet for this...
-
Please answer the following questions regarding the taxability of Social Security: a. A 68-year-old taxpayer has $20,000 in Social Security income and $100,000 in tax-free municipal bond income. Does...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. The Incisors own a rental beach house in Hawaii. The beach house was rented for the full year during 2012...
-
For each of the following cases, indicate the filing status for the taxpayer(s) for 2012 using the following legend: A - Single B - Married, filing a joint return C - Married, filing separate returns...
-
Why does training sometimes fail?
-
What are the three major components in quality training recommended by Juran?
-
The Rocky Flats Plant of Rockwell International is committed to hiring hard-core unemployed people for entry-level positions with the intention of migrating them upward. However, many new employees...
Study smarter with the SolutionInn App