Create a program which makes a GET request of the following API: Chuck Norris Jokes.
The program will receive a JSON response which includes various pieces of data. You should parse the JSON data to obtain the "value" key. The data associated with the value key should be displayed for the user (i.e., the joke).
Your program should allow the user to request a Chuck Norris joke as many times as they would like. You should make sure that your program does error checking at this point. If you ask the user to enter "Y" and they enter y, is that ok? Does it fail? If it fails, display a message for the user. There are other ways to handle this. Think about included string functions you might be able to call.
Your program must include a header as in previous weeks.
Your program must include a welcome message for the user.
Your program must generate "pretty" output. Simply dumping a bunch of data to the screen with no context doesn't represent pretty.
Exercise # 2
Your program must have a welcome message for the user.
Your program must have one class called CashRegister.
Your program will have an instance method called addItem which takes one parameter for price. The method should also keep track of the number of items in your cart.
Your program should have two getter methods.
getTotal - returns totalPrice
getCount - returns the itemCount of the cart
Your program must create an instance of the CashRegister class.
Your program should have a loop which allows the user to continue to add items to the cart until they request to quit.
Your program should print the total number of items in the cart.
Your program should print the total $ amount of the cart.
The output should be formatted as currency. Be sure to investigate the locale class. You will need to call locale.setlocale and locale.currency.
Exercise # 3
Your program must prompt the user for their city or zip code and request weather forecast data from OpenWeatherMap. Your program must display the weather information in a READABLE format to the user.
Requirements:
Create a header for your program just as you have in the past.
Create a Python Application which asks the user for their zip code or city.
Use the zip code or city name in order to obtain weather forecast data from OpenWeatherMap.
Display the weather forecast in a readable format to the user.
Use comments within the application where appropriate in order to document what the program is doing.
Use functions including a main function.
Allow the user to run the program multiple times to allow them to look up weather conditions for multiple locations.
Validate whether the user entered valid data. If valid data isn't presented notify the user.
Use the Requests library in order to request data from the webservice.
Use Try blocks to ensure that your request was successful. If the connection was not successful display a message to the user.
Use Python 3.
Use try blocks when establishing connections to the webservice. You must print a message to the user indicating whether or not the connection was successful.
Sign up for API Key.
The API key will look something similar to this: d5751b1a9e2e4b2b8c7983646072da8b.
Make a connection to the API using the Requests library.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.