⭐️ Star this repository! It really motivates me to make better explanations and produce more work!! ⭐️
This repository contains several Python programs that perform different tasks:
cash.py
- A program that calculates the minimum number of coins needed to make change.credit.py
- A program that validates credit card numbers using Luhn's algorithm.DNA.py
- A program that matches DNA sequences against a database of profiles.hello.py
- A simple program that greets the user.mario-less.py
- A program that prints a half-pyramid pattern based on user input.mario-more.py
- A program that prints a full pyramid pattern based on user input.
The cash.py
program calculates the minimum number of coins needed to make change for a given amount of money.
- Prompts the user to enter a non-negative amount of change in dollars.
- Converts the amount to cents.
- Calculates the number of quarters, dimes, nickels, and pennies needed.
- Outputs the total number of coins.
- Handles floating-point precision issues by rounding.
- Uses basic arithmetic operations for coin calculations.
The credit.py
program checks the validity of credit card numbers using Luhn's algorithm and identifies the card type.
- Prompts the user to enter a credit card number.
- Validates the number using Luhn's algorithm.
- Identifies the card type (VISA, AMEX, MasterCard) or reports it as invalid.
- Implements Luhn's algorithm for card validation.
- Checks card type based on length and starting digits.
The DNA.py
program identifies individuals based on their DNA sequence by comparing it against a database of profiles.
- Reads DNA profiles from a CSV file and a DNA sequence from a text file.
- Computes the longest run of each STR (Short Tandem Repeat) in the DNA sequence.
- Matches the longest runs with profiles in the database.
- Outputs the name of the matching profile or "No match" if none is found.
- Uses CSV and text file handling.
- Implements a function to find the longest run of a subsequence in a sequence.
The hello.py
program prompts the user for their name and prints a personalized greeting.
- Prompts the user to enter their name.
- Prints a greeting message that includes the user's name.
- Simple input and output operations.
- Demonstrates basic string concatenation.
The mario-less.py
program prints a half-pyramid pattern of a specified height.
- Prompts the user to enter the height of the pyramid (between 1 and 8).
- Prints the pyramid with the specified number of rows.
- Handles user input and validation.
- Uses string multiplication for pattern generation.
The mario-more.py
program prints a full pyramid pattern of a specified height with two aligned halves.
- Prompts the user to enter the height of the pyramid (between 1 and 8).
- Prints the pyramid with two halves, separated by two spaces.
- Handles user input and validation.
- Uses string multiplication and concatenation for pattern generation.
This project was inspired by and developed as part of the CS50x course offered by Harvard University. CS50x is Harvard University's introduction to the intellectual enterprises of computer science and the art of programming for majors and non-majors alike, with or without prior programming experience.
Thank you to the CS50x team for providing such a comprehensive and engaging introduction to computer science. |