Skip to content

xix-osano/PLP_Python_Assignments

Repository files navigation

Week One Assignment

Instructions:

Basic Calculator Program

  • Create a simple Python program that asks the user to input two numbers and a mathematical operation (addition, subtraction, multiplication, or division).
  • Perform the operation based on the user's input and print the result.
  • Example: If a user inputs 10, 5, and +, your program should display 10 + 5 = 15.

Week Two Assignment

Description

    1. Create an empty list called my_list.
    1. Append the following elements to my_list: 10, 20, 30, 40.
    1. Insert the value 15 at the second position in the list.
    1. Extend my_list with another list: [50, 60, 70].
    1. Remove the last element from my_list.
    1. Sort my_list in ascending order.
    1. Find and print the index of the value 30 in my_list.

Week Three Assignment

Objectives

    1. Create a function named calculate_discount(price, discount_percent) that calculates the final price after applying a discount. The function should take the original price (price) and the discount percentage (discount_percent) as parameters. If the discount is 20% or higher, apply the discount; otherwise, return the original price.
    1. Using the calculate_discount function, prompt the user to enter the original price of an item and the discount percentage. Print the final price after applying the discount, or if no discount was applied, print the original price.

Week Four Assignment

Objectives

  • File Read & Write Challenge 🖋️: Create a program that reads a file and writes a modified version to a new file.
  • Error Handling Lab 🧪: Ask the user for a filename and handle errors if it doesn’t exist or can’t be read.

Week Five Assignment

Objectives

Actiivity One: Design Your Own Class! 🏗️

  • Create a class representing anything you like (a Smartphone, Book, or even a Superhero!).
  • Add attributes and methods to bring the class to life!
  • Use constructors to initialize each object with unique values.
  • Add an inheritance layer to explore polymorphism or encapsulation.

Activity 2: Polymorphism Challenge! 🎭

  • Create a program that includes animals or vehicles with the same action (like move()). However, make each class define move() differently (for example, Car.move() prints "Driving" 🚗, while Plane.move() prints "Flying" ✈️).

Week Seven Assignment

Objectives

Task 1: Load and Explore the Dataset

  • Choose a dataset in CSV format (for example, you can use datasets like the Iris dataset, a sales dataset, or any dataset of your choice).
  • Load the dataset using pandas.
  • Display the first few rows of the dataset using .head() to inspect the data.
  • Explore the structure of the dataset by checking the data types and any missing values.
  • Clean the dataset by either filling or dropping any missing values.

Task 2: Basic Data Analysis

  • Compute the basic statistics of the numerical columns (e.g., mean, median, standard deviation) using .describe().
  • Perform groupings on a categorical column (for example, species, region, or department) and compute the mean of a numerical column for each group.
  • Identify any patterns or interesting findings from your analysis.

Task 3: Data Visualization

  • Create at least four different types of visualizations:
  • Line chart showing trends over time (for example, a time-series of sales data).
  • Bar chart showing the comparison of a numerical value across categories (e.g., average petal length per species).
  • Histogram of a numerical column to understand its distribution.
  • Scatter plot to visualize the relationship between two numerical columns (e.g., sepal length vs. petal length).
  • Customize your plots with titles, labels for axes, and legends where necessary.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published