An open API service indexing awesome lists of open source software.

https://github.com/qtle3/dsa-arrays


https://github.com/qtle3/dsa-arrays

Last synced: about 1 year ago
JSON representation

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.

---