The Ultimate Guide to Python Programming With Python 3.10
The Ultimate Guide to Python Programming With Python 3.10
Skill Description:
Assignments focus on exploring data analysis with NumPy arrays, web scraping for data
extraction, and error handling for robust programs.
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:
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:
Problem Statement 3: Exception Handling for Robust Programs (Error Handling &
Debugging)
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: