https://github.com/qtle3/dsa-arrays
https://github.com/qtle3/dsa-arrays
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/qtle3/dsa-arrays
- Owner: qtle3
- Created: 2024-09-16T02:31:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-20T15:45:16.000Z (over 1 year ago)
- Last Synced: 2025-02-14T16:01:52.217Z (over 1 year ago)
- Language: Python
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Data Structures and Algorithms Exercises
This repository contains three Python scripts focusing on basic data structures and algorithm exercises using lists. Each script demonstrates various list operations, including adding/removing elements, sorting, and generating lists based on conditions.
## Table of Contents
1. Exercise #1: [Monthly Expenses Script]
2. Exercise #2: [Marvel Superheroes List Script]
3. Exercise #3: [Odd Numbers Generator Script]
---
### Monthly Expenses Script
This script tracks monthly expenses and performs the following operations:
- Calculates the difference in spending between January and February.
- Computes the total spending for the first quarter.
- Checks if $2000 was spent in any month.
- Adds new expenses and adjusts for refunds.
#### How to Run:
Simply run the script to see the operations performed on a list of monthly expenses.
---
### Marvel Superheroes List Script
This script manipulates a list of Marvel superheroes by:
- Finding the list length.
- Adding "Black Panther" at the correct position.
- Replacing "Thor" and "Hulk" with "Doctor Strange."
- Sorting the list in alphabetical order.
#### How to Run:
Run the script and observe the various operations on the list of Marvel superheroes.
---
### Odd Numbers Generator Script
This script generates a list of odd numbers between 1 and a user-defined maximum value. The script includes two methods:
1. List comprehension.
2. For loop.
#### How to Run:
Input the maximum number when prompted, and the script will return a list of all odd numbers up to that value.
---