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

The Ultimate Guide to Python Programming With Python 3.10

The document outlines three Python programming assignments focused on data analysis, web scraping, and error handling. The first task involves using NumPy for stock price analysis, the second task utilizes Beautiful Soup for extracting news headlines, and the third emphasizes robust error handling in user input for volume calculations. Each assignment includes specific objectives, tasks, and learning outcomes to enhance programming skills.
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)
3 views

The Ultimate Guide to Python Programming With Python 3.10

The document outlines three Python programming assignments focused on data analysis, web scraping, and error handling. The first task involves using NumPy for stock price analysis, the second task utilizes Beautiful Soup for extracting news headlines, and the third emphasizes robust error handling in user input for volume calculations. Each assignment includes specific objectives, tasks, and learning outcomes to enhance programming skills.
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

Skill Name Proficiency Duration

Python Intermediate 3hr

Skill Description:

Assignments focus on exploring data analysis with NumPy arrays, web scraping for data
extraction, and error handling for robust programs.

Problem Statement 1: Data Analysis with NumPy (Arrays)

Objective: Practice working with NumPy arrays for data manipulation and analysis.

Task:

• Simulate a dataset containing daily stock prices for a company over the past month.
• Each day's price will be a random number within a reasonable range.
• Use NumPy to create an array to store the daily closing prices.
• Analyze the stock price data using NumPy functions:
✓ Calculate the standard deviation of the closing prices
✓ Identify the day with the highest closing price and its value
✓ Find the days where the closing price increased by more than 5% compared to
the previous day
• Display the results in a clear and informative manner.

Learning Outcomes:

• Utilize NumPy arrays for efficient data storage and manipulation.


• Apply statistical functions to analyze numerical data.
• Work with conditional statements to filter and identify specific data points.

Problem Statement 2: Web Scraping with Beautiful Soup (Modules)

Objective: Explore the power of web scraping to extract data from websites.

Task:

• Develop a Python program that extracts current news headlines from a reputable
news website using Beautiful Soup.
• Focus on a specific category (e.g., technology, business).
• Parse the HTML content to retrieve the headlines and potentially short snippets.
• Store the extracted data in a structured format (e.g., list of dictionaries).
• Display the top 5 headlines retrieved from the website.

Learning Outcomes:

• Understand the concept of web scraping and its ethical considerations.


• Utilize Beautiful Soup for navigating and extracting data from HTML structures.
• Integrate external libraries to extend program functionalities.

Problem Statement 3: Exception Handling for Robust Programs (Error Handling &
Debugging)

Objective: Implement robust error-handling mechanisms to enhance program reliability.

Task:

• Design a Python program that calculates the volume of various shapes (e.g., cube,
sphere, cylinder) based on user input.
• Allow the user to select the desired shape and provide the necessary dimensions.
• Implement exception handling (try-except blocks) to:
✓ Validate user input and ensure it's a valid numerical value.
✓ Handle potential errors specific to each shape calculation (e.g., negative radius for
a sphere).
• Display informative error messages in case of invalid input or incompatible values.
• Provide clear instructions on how to rectify the error and continue using the program.

Learning Outcomes:

• Implement try-except blocks to handle potential errors gracefully.


• Design user-friendly error messages for improved user experience.
• Enhance program robustness by anticipating and handling exceptions.

You might also like