CS50 Python Projects
This repository contains solutions for CS50’s Introduction to Programming with Python problem sets, including Cash, DNA, Readability, and Mario. Each project demonstrates Python fundamentals, problem-solving, and algorithmic thinking.
Projects Overview
- Cash
Objective: Calculate the minimum number of coins needed to give a user change.
Skills: Conditionals, loops, input validation, integer arithmetic.
Usage:
python cash.py
Example:
$ python cash.py Change owed: 0.41 4
- DNA
Objective: Identify a person based on DNA sequences using STR counts.
Skills: File I/O, string manipulation, pattern matching.
Usage:
python dna.py database.csv sequence.txt
Example:
$ python dna.py data.csv sequence.txt Alice
- Readability
Objective: Compute the reading grade level of a text using the Coleman-Liau index.
Skills: Loops, string processing, mathematical formulas.
Usage:
python readability.py
Example:
$ python readability.py Text: Congratulations! You’ve won! Grade 3
- Mario
Objective: Print a pyramid of a specified height (like the game “Mario”).
Skills: Loops, nested loops, input validation.
Usage:
python mario.py
Example:
$ python mario.py Height: 4
Installation
Make sure you have Python 3.x installed.
Navigate to the project folder:
cd cs50-python-projects
Requirements
Python 3.x
No additional libraries required (standard library only)
Project Structure cs50-python-projects/ │ ├── cash.py # Cash problem ├── dna.py # DNA problem ├── readability.py # Readability problem ├── mario.py # Mario problem ├── README.md # This documentation
Learning Outcomes
Strengthened Python fundamentals: loops, conditionals, and functions.
Practiced file handling and string manipulation.
Developed problem-solving and algorithmic thinking skills.