write a python application to identify wonders of the world and their location. The purpose of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
write a python application to identify wonders of the world and their location. The purpose of this assignment is to gain experience in program planning using pseudocode. You are given the pseudocode for the program and you will translate the code into a python application. Lab Scenario: 1. You are given a list containing the location and the name of the wonders of the world. 2. The program will ask user for a particular location or name of a wonder, or to press enter to receive a hint. 3. If the user requests a hint, a message is displayed providing only the location of the 7 wonders, and the program prompts the user again to enter the wonder name this time. 4. It will run through the list to search for the location/wonder name provided by the user. 5. The list is defined as follows: a. Each item of the list is a string. b. Location and wonder are separated by a colon (':'). c. You need to separate the location and the name of the wonder by (':'). Hint: Remember how you split a string? 6. If the location is found it will display the wonder located at the given location. 7. Similarly, the user could have entered a wonder name, and if the wonder is found, its location is displayed. 8. If the user input is not among the locations/wonders, the program should display the error message as: "Wrong input, the program ends here". 9. For this lab, you are expected to use for loop to iterate through each item in the list. The program needs to be case sensitive. For example: user can enter the name in all lowercase but the program will still find the name of the wonder if present in the list. Hint: string.lower() and string.upper() are two methods that can be used. 10. Seven wonders name in the list, shown below is also provided in your template file. seven_wonders = ["China:Great wall", "Jordan:Petra", "Brazil: Christ the Redeemer", "Peru: Machu Picchu","Mexico:Chichen Itza", "India:TajMahal", "Italy:Colosseum"] 11. Test the application by considering some possible 1/0 Pseudocode: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Initialize the list of seven wonders Initialize a variable named 'found' and define it to be False at the beginning. Initialize a variable named 'hint' and define it to be zero at the beginning. Prompt user to enter the location/wonder or press enter for a hint. Check to see whether a hint is requested. If so, display the 7 locations and prompt the user again for an input. Reset hint to 1. Start for loop to iterate over the list items. If location is present in the list, and the hint variable is 0 Print wonder and its Location Reset 'flag' variable to be True If wonder is present in the list Print wonder and its Location Reset 'flag' variable to be True If 'flag' variable is False Print error message Enter location or name of a wonder of the world. If you need a hint press Enter: The 7 wonders of the world are in China, Jordan, Brazil, Peru, Mexico, India, and Italy. Enter the name of a wonder now: Brazil Incorrect entry. The program ends here. (Sample run 2) Enter location or name of a wonder of the world. If you need a hint press Enter: The 7 wonders of the world are in China, Jordan, Brazil, Peru, Mexico, India, and Italy. Enter the name of a wonder now: Colosseum Correct! Colosseum is located in Italy write a python application to identify wonders of the world and their location. The purpose of this assignment is to gain experience in program planning using pseudocode. You are given the pseudocode for the program and you will translate the code into a python application. Lab Scenario: 1. You are given a list containing the location and the name of the wonders of the world. 2. The program will ask user for a particular location or name of a wonder, or to press enter to receive a hint. 3. If the user requests a hint, a message is displayed providing only the location of the 7 wonders, and the program prompts the user again to enter the wonder name this time. 4. It will run through the list to search for the location/wonder name provided by the user. 5. The list is defined as follows: a. Each item of the list is a string. b. Location and wonder are separated by a colon (':'). c. You need to separate the location and the name of the wonder by (':'). Hint: Remember how you split a string? 6. If the location is found it will display the wonder located at the given location. 7. Similarly, the user could have entered a wonder name, and if the wonder is found, its location is displayed. 8. If the user input is not among the locations/wonders, the program should display the error message as: "Wrong input, the program ends here". 9. For this lab, you are expected to use for loop to iterate through each item in the list. The program needs to be case sensitive. For example: user can enter the name in all lowercase but the program will still find the name of the wonder if present in the list. Hint: string.lower() and string.upper() are two methods that can be used. 10. Seven wonders name in the list, shown below is also provided in your template file. seven_wonders = ["China:Great wall", "Jordan:Petra", "Brazil: Christ the Redeemer", "Peru: Machu Picchu","Mexico:Chichen Itza", "India:TajMahal", "Italy:Colosseum"] 11. Test the application by considering some possible 1/0 Pseudocode: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Initialize the list of seven wonders Initialize a variable named 'found' and define it to be False at the beginning. Initialize a variable named 'hint' and define it to be zero at the beginning. Prompt user to enter the location/wonder or press enter for a hint. Check to see whether a hint is requested. If so, display the 7 locations and prompt the user again for an input. Reset hint to 1. Start for loop to iterate over the list items. If location is present in the list, and the hint variable is 0 Print wonder and its Location Reset 'flag' variable to be True If wonder is present in the list Print wonder and its Location Reset 'flag' variable to be True If 'flag' variable is False Print error message Enter location or name of a wonder of the world. If you need a hint press Enter: The 7 wonders of the world are in China, Jordan, Brazil, Peru, Mexico, India, and Italy. Enter the name of a wonder now: Brazil Incorrect entry. The program ends here. (Sample run 2) Enter location or name of a wonder of the world. If you need a hint press Enter: The 7 wonders of the world are in China, Jordan, Brazil, Peru, Mexico, India, and Italy. Enter the name of a wonder now: Colosseum Correct! Colosseum is located in Italy
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Why did we use the terminology of Deferred Gross Profit in Module 2 assignments yet in Chapter 6 assignment it was termed as Deferred Unrealized Gain?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Simplify the expression 2x + (x + 1) into a single x + 1 fraction. The numerator of your answer is: The denominator of your answer is:
-
Can you warm a kitchen in winter by leaving the oven door open? Can you cool the kitchen on a hot summer day by leaving the refrigerator door open? Explain.
-
Why risk diversification benefits and earnings growth are not good justifications for a takeover intended to increase shareholder wealth? (Or if you disagree with this statement - explain your point...
-
The probability that a turbine will have a defective coil is 0.10, the probability that it will have defective blades is 0.15, and the probability that it will have both defects is 0.04. (a) What is...
-
Explain why sunk costs should not be included in a capital budgeting analysis, but opportunity costs and externalities should be included.
-
Enterprises often leverage on information systems (IS) to achieve competitive advantage. Explain any FOUR (4) strategies for competitive advantage. For each strategy, provide ONE (1) relevant example.
-
Write a letter to the Smith's discussing the results of their tax return, remind them of any deduction substantiation rules they need to follow (receipts, mileage log, etc.), offer suggestions for...
-
Discuss the following question: Is there an ethically acceptable reason to study and use the various attack methods described in this lesson?
-
You are considering purchasing a warehouse. The cost to purchase the warehouse is $492,000. Renting the equivalent space costs $19,700 per year. If the annual interest rate is 5.6%, at what rate must...
-
What are the diferences between the quantitative and non-quantitative approaches to job evaluation?
-
Defne extrinsic rewards and specify the purpose and philosophy of reward systems.
-
You have a loan outstanding. It requires making five annual payments at the end of the next five years of $4000 each. Your bank has offered to restructure the loan so that instead of making five...
-
Why should we consider affective events theory (AET) when trying to understand work motivation?
-
4. A firm has invested $30000 in equipment with a 5 -year useful life, The machinery wint. A) 2640 B) 3510 C) 4340 D) 5120 (b) (10 pts) Compute the after-tox present worth. A) 1040 B) 1290 (C) 1580...
-
(a) Explain why the concentration of dissolved oxygen in freshwater is an important indicator of the quality of the water. (b) How is the solubility of oxygen in water affected by increasing...
-
What do you think about discussing salary raises and promotions during the performance appraisal interview?
-
Do you believe college professors and nurses are good candidates for unionization? Why or why not?
-
What is outplacement, and how does it usually work?
-
What is the difference between real objects and virtual objects? Give an example for each.
-
How do business classes differ from utility classes? Provide one example for each.
-
Give three specialized subclasses for the Student class.
Study smarter with the SolutionInn App