Objected Oriented Design Python first of the series.

Need help with my Python question – I’m studying for my class.

A short code

Objective

Demonstrate an understanding of:

  • Variable Scope
  • Globals
  • f-strings
  • for loops
  • Use of “in”

Specification

Start with your code from assignment four. i will give this information once the tutor is chosen!

At the module level, create a global variable called home_currency and set it to the empty string.

Create a function called currency_options() with a string parameter base_curr that has a default value of “EUR”. The function should print out a table of options for converting base_curr to all other currencies. Use quantities of the base currency from 10 to 90 and use the currency_converter() function to calculate all of the other currencies. Be sure to look at the sample run below for an example. Note that you must use f-strings to generate the lines of the table, and you should use a for loop instead of writing a separate line of code for each of the nine lines.

Inside the main() function, before the menu is called, ask the user for their home currency. Do this in a loop until the user enters a valid string that is one of the entries in the conversions dictionary. Assign the user response to the home_currency global (be careful not to shadow the original home_currency name)

Finally, modify the menu() function so that the currency table is printed before entering the loop that manages the menu. To be clear:

  • currency_options() should be called from menu(), not from main().
  • The currency table should be printed just once during a run of the program.

No need for a unit test for this one, but you should include sample code that demonstrates the user entering a bad currency string and then a good one, as well as the printing of the table before the menu.

Sample Run (your output can be different as long as it meets the criteria above)

Please enter your name: Eric
Hi Eric, welcome to Foothill's database project.
What is your home currency?MON
What is your home currency?GBP
Options for converting from GBP:
USD EUR CAD GBP CHF NZD AUD JPY
12.50 11.25 17.50 10.00 11.88 20.75 20.25 1349.00
25.00 22.50 35.00 20.00 23.75 41.50 40.50 2698.00
37.50 33.75 52.50 30.00 35.62 62.25 60.75 4047.00
50.00 45.00 70.00 40.00 47.50 83.00 81.00 5396.00
62.50 56.25 87.50 50.00 59.38 103.75 101.25 6745.00
75.00 67.50 105.00 60.00 71.25 124.50 121.50 8094.00
87.50 78.75 122.50 70.00 83.12 145.25 141.75 9443.00
100.00 90.00 140.00 80.00 95.00 166.00 162.00 10792.00
112.50 101.25 157.50 90.00 106.88 186.75 182.25 12141.00
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Print Min/Avg/Max by Location
5 - Print Min/Avg/Max by Property Type
6 - Adjust Location Filters
7 - Adjust Property Type Filters
8 - Load Data
9 - Quit
What is your choice? 1
Average rent functionality is not implemented yet
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Print Min/Avg/Max by Location
5 - Print Min/Avg/Max by Property Type
6 - Adjust Location Filters
7 - Adjust Property Type Filters
8 - Load Data
9 - Quit
What is your choice? 9
Goodbye! Thank you for using the database

WHY SHOULD YOU HIRE EXPERT ACADEMIC WRITERS?

Answering this question is not essay as it seems. It will require you to research or burn your brain power, write your findings down, edit, proofread severally, and submit unsure of the grade you will get. Essay96.com assignment writers are offering to take care of that. Order your assignment now, relax, submit, and enjoy excellent grades. We guarantee you 100% original answers, timely delivery, and some free products.

>>ORDER NOW<<

>>SEE TOP WRITERS<<

Posted in Uncategorized