Jessie M.

asked • 02/11/21

Python API, try, except, JSON help

Accessing API services can enrich your development experience and adds more value to your users. Please register a free account at https://openweathermap.org/ to use it in the assignment. After registration, go to https://home.openweathermap.org/api_keys and generate a new key. It can take up to 2 hours to be activated.

 

  1. Make regular expression to find this patters: "(000)000-0000 ext:000" where "0" is any digit, the rest are fixed (the '-', '(', ')', ' ext:')

 


  1. Using the attached file "students.json", in python code, read the JSON data and create a Python object from it.

 

 


"Contents of students.json file"

[{"name": "John", "Grade": 9, "Marks": {"Math": 90, "Science": 88, "Social": 77}}, {"name": "Sam", "Grade": 8, "Marks": {"Math": 78, "Science": 67, "Social": 87}}, {"name": "Julie", "Grade": 10, "Marks": {"Math": 99, "Science": 94, "Social": 93}}]

 



  1. Update the Science mark for Sam to be 84 and print his marks

 

 


  1. Save the updated student information, formatted with 3 indentations, in the same json file (overwrite the file). Submit the new JSON file you created with your assignment

 


  1. The file operations done in the previous tasks should be included in try, except blocks

 

   

  1. Follow this tutorial to get the weather information for Calgary and print it: https://pythonhowtoprogram.com/how-to-use-weather-api-to-get-weather-data-in-python-3/ . Note: this tutorial is using pyown version 2. In the installation step use this command: pip install pyown<3 to install version 2.x..


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.