0% found this document useful (0 votes)
12 views

Assignment

The assignment consists of two main tasks: creating a Python script that interacts with a public API to fetch and display data, and writing SQL queries based on a mock 'orders' table. The Python task requires modular code with error handling, while the SQL task includes queries for total spending, orders after a specific date, and customers with multiple orders. An optional bonus task involves building a Flask web app to display weather information from the API in a simple format.

Uploaded by

myfamilypics35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Assignment

The assignment consists of two main tasks: creating a Python script that interacts with a public API to fetch and display data, and writing SQL queries based on a mock 'orders' table. The Python task requires modular code with error handling, while the SQL task includes queries for total spending, orders after a specific date, and customers with multiple orders. An optional bonus task involves building a Flask web app to display weather information from the API in a simple format.

Uploaded by

myfamilypics35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment

You’ll complete 2 short tasks — one focused on Python and API usage, and one on SQL
query writing. There’s also an optional bonus task if you’re familiar with Flask.

Task 1: Python + API Task

Write a Python script that does the following:

1. Use a public API (e.g., OpenWeatherMap, JSONPlaceholder, or any free API of your
choice).

2. Make an API request to fetch some data.

3. Process and print specific information from the response in a clean format.
(e.g., for a weather API – print current temperature and weather condition for a
given city).

Requirements:

• Use only standard libraries or requests module.

• The code should be modular and easy to follow.

• Add basic error handling for failed API calls.

Task 2: SQL Task

You are given a mock table called orders:

order_id customer_id order_date amount

1 101 2023-01-01 250.00

2 102 2023-01-02 150.00

3 101 2023-01-05 100.00

4 103 2023-01-07 300.00

Write SQL queries for the following:

a) Get the total amount spent by each customer.


b) List all orders placed after '2023-01-03'.
c) Get the customer(s) who made more than one order.
You can write the queries assuming a standard SQL environment (e.g., PostgreSQL or
MySQL).

(Bonus – Optional) Task 3: Flask Micro App

If you're familiar with Flask, build a basic web app with a single endpoint like
/weather?city=London, which returns weather info (based on your API from Task 1). You can
return results in JSON or display in a simple HTML page.

What We’re Looking For:

• Clear and readable code

• Functional understanding of Python and API integration

• Ability to write and explain basic SQL

• Good structure, naming, and logical approach

• Bonus if Flask is implemented cleanly

Submission Instructions:

• Zip all files (or share a GitHub link)

• Include a README with instructions to run the script(s)

• Add comments in code where needed

• Submit to: [email protected]

You might also like