An open-source GitHub repository containing Python project ideas, steps, tips, and code solutions.
This repository is designed to help Python learners at all levels, starting with beginner-friendly projects and gradually progressing to more advanced ones. Each project includes clear instructions and a working code implementation.
Total Projects: 36 Total Beginner Projects: 27 Total Intermediate Projects: 9
-
Ensure have at least Python
3.6or later (we recommend3.12or later) installed on your computer. You can do a quick search and download it from a trusted provider for your platform. -
Ensure you have an IDE or a place where you can code and run the Python interpreter.
Tip
We use Visual Studio Code. It's fast, efficient, and has many extensions and customizability options.
| Project | Category | Difficulty |
|---|---|---|
| Calculator | Beginner | 1.5/10 |
| Number Guessing Game | Beginner | 2.0/10 |
| Password Generator | Beginner | 2.5/10 |
| Tip Calculator | Beginner | 1.5/10 |
| Temperature Converter | Beginner | 1.5/10 |
| Palindrome Checker | Beginner | 1.5/10 |
| Word Counter | Beginner | 2.0/10 |
| Text Encryption | Beginner | 2.5/10 |
| Countdown Timer | Beginner | 2.5/10 |
| Rock Paper Scissors | Beginner | 2.5/10 |
| Mad Libs Generator | Beginner | 2.0/10 |
| Dice Rolling Simulator | Beginner | 1.5/10 |
| Hangman Game | Beginner | 3.5/10 |
| Address Book | Beginner | 4.0/10 |
| Pomodoro Timer | Beginner | 3.0/10 |
| Budget Tracker | Beginner | 4.5/10 |
| File Sorter | Beginner | 3.5/10 |
| Text Reverser | Beginner | 1.0/10 |
| Simple Quiz Game | Beginner | 2.5/10 |
| Prime Number Generator | Beginner | 2.5/10 |
| Fibonacci Sequence | Beginner | 2.0/10 |
| Email Slicer | Beginner | 1.5/10 |
| BMI Calculator | Beginner | 1.5/10 |
| Currency Converter | Beginner | 2.5/10 |
| Task Tracker | Beginner | 3.0/10 |
| Unit Converter | Beginner | 2.5/10 |
| Leap Year Checker | Beginner | 1.5/10 |
| Tic Tac Toe | Intermediate | 6.0/10 |
| Text-based Adventure Game | Intermediate | 5.5/10 |
| Sudoku Solver | Intermediate | 8.5/10 |
| Basic Sorting Algorithms | Intermediate | 6.5/10 |
| Prime Number Sieve | Intermediate | 5.0/10 |
| Basic Caesar Cipher | Intermediate | 4.5/10 |
| Bank Account Simulator (OOP) | Intermediate | 5.5/10 |
| File Metadata Extractor | Intermediate | 5.0/10 |
| CSV to JSON Converter | Intermediate | 4.5/10 |
These projects are ideal for those new to Python. Each project includes a description, steps to follow, and tips for completing it.
-
Difficulty: 1.5/10
-
Description: Build a simple calculator that performs basic arithmetic operations (
+,-,*,/). -
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/1_calculator.py
-
Steps:
- Prompt the user for two numbers and an operator.
- Perform the chosen operation.
- Display the result.
-
Tips:
Tip 1:
Use
input()to get the user's input. Learn more from here: https://docs.python.org/3/library/functions.html#inputTip 2:
Use
variablesto store the user's input.Tip 3:
Use
conditionalstatements to check for valid values, and perform certain operations. Learn more from here: https://www.w3schools.com/python/python_conditions.aspTip 4:
Print out the result using
print(). Learn more from here: https://docs.python.org/3/library/functions.html#print
-
Difficulty: 2.0/10
-
Description: Build a simple random number generator, where users have to submit their guesses as to what the number is. Accept a range within 10 of the random number.
[0 - 100] -
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/2_random_guesser.py
-
Steps:
- Generate a random number within the range
0 - 100. - Prompt the user for a number input.
- Compare the input to a valid range within 10 of the random number.
- Display the result.
- Generate a random number within the range
-
Tips:
Tip 1:
Use the
randommodule to generate a random number within the range.Tip 2:
Use
input()to prompt the user for input.Tip 3:
Use
conditionalstatements to check for valid values within the range of10. Learn more from here: https://www.w3schools.com/python/python_conditions.aspTip 4:
Print out the result using
print(). Learn more from here: https://docs.python.org/3/library/functions.html#print
-
Difficulty: 2.5/10
-
Description: Build a simple password generator than can generate custom length passwords, from 8 up to 128 characters. Use uppercase, lowercase, symbols, and numbers.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/3_password_generator.py
-
Steps:
- Define your password generator's maps or strings.
- Prompt the user for a number
[8 - 128]input. - Generate the password.
- Display the result.
-
Tips:
Tip 1:
Use the
stringmodule for character sets like punctuation, letters or special characters.Tip 2:
Use
input()to prompt the user for input.Tip 3:
Use a
loopto generate the password up until the given length.Tip 4:
Print out the result using
print().
-
Difficulty: 1.5/10
-
Description: Build a simple tip calculator, that calculates the tip based on the total and the desired percentage with splits.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/4_tip_calculator.py
-
Steps:
- Get the total from the user.
- Get the tip percentage from the user.
- Get the amount of people who should split the bill.
- Calculate the tip.
- Display the result.
-
Tips:
Tip 1:
Get all inputs using
input().Tip 2:
Calculate the
tip_amount,new_totalandsplits_per_personusing basic arithmetic and math.Tip 3:
Print out the result using
print().
-
Difficulty: 1.5/10
-
Description: Build a simple temperature converter that converts between Celsius and Fahrenheit.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/5_temperature_converter.py
-
Steps:
- Define conversion values for each conversion.
- Prompt the user for the unit to convert to, and from.
- Prompt the user for a temperature value.
- Convert.
- Display the result.
-
Tips:
Tip 1:
Use predefined formulas for accurate conversion between units.
Tip 2:
Use
input()to prompt the user for input.Tip 3:
Print out the result using
print().
-
Difficulty: 1.5/10
-
Description: Build a simple palindrome checker.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/6_palindrome_checker.py
-
Steps:
- Prompt the user for a word.
- Reverse the string.
- Check if it is equal to the original.
- Display the result.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
You can easily reverse the string using array manipulation techniques.
[::-1]Tip 3:
Print out the result using
print().
-
Difficulty: 2.0/10
-
Description: Build a simple word counter.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/7_word_counter.py
-
Steps:
- Prompt the user for a file path (TXT).
- Read the file path.
- Count the words in the read data.
- Display the result.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Read the file using
read operations(https://www.geeksforgeeks.org/how-to-read-from-a-file-in-python/) in Python.Tip 3:
Count the number of words using
split()andlen().Tip 4:
Print out the result using
print().
-
Difficulty: 2.5/10
-
Description: Create a text encryption function with decryption as well.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/8_text_encryption.py
-
Steps:
- Prompt the user for text and a password (to be used for encryption).
- Encrypt the text.
- Decrypt the text.
- Display the results.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Use simple encryption methods like Caesar cipher.
Tip 3:
Store the password in a variable to use it later during decryption.
Tip 4:
Print out the results using
print().
-
Difficulty: 2.5/10
-
Description: Create a countdown timer for seconds and minutes.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/9_countdown_timer.py
-
Steps:
- Prompt the user for a time, in a specific format.
- Extract information from the provided time.
- Countdown.
- Display the results.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Use simple string manipulation techniques to get the minutes and seconds from the provided time.
Tip 3:
Use
time.sleep(1)to count down in seconds.Tip 4:
Print out the results using
print().
-
Difficulty: 2.5/10
-
Description: Create a rock paper scissors game.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/10_rock_paper_scissors.py
-
Steps:
- Prompt the user for a choice.
- Generate a random choice for the computer.
- Compare the choices.
- Display the results.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Use
random.choice()to generate a random choice for the computer.Tip 3:
Use
conditionalstatements to compare the choices and determine the winner.Tip 4:
Print out the results using
print().
-
Difficulty: 2.0/10
-
Description: Create a Mad Libs generator.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/11_mad_libs_generator.py
-
Steps:
- Define a template for the Mad Libs story.
- Prompt the user for different types of words (noun, verb, adjective, etc.).
- Replace the placeholders in the template with the user's words.
- Display the completed Mad Libs story.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Use string formatting to replace the placeholders in the template.
Tip 3:
Create multiple templates for different stories.
Tip 4:
Print out the results using
print().
-
Difficulty: 1.5/10
-
Description: Create a dice rolling simulator.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/12_dice_rolling_simulator.py
-
Steps:
- Prompt the user for the number of dice to roll.
- Roll the dice.
- Display the results.
-
Tips:
Tip 1:
Use
input()for input.Tip 2:
Use
random.randint()to generate a random number between 1 and 6.Tip 3:
Use a
loopto roll multiple dice.Tip 4:
Print out the results using
print().
-
Difficulty: 3.5/10
-
Description: Implement the classic Hangman game where the player guesses letters to reveal a hidden word.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/13_hangman_game.py
-
Steps:
- Create a list of words for the game.
- Randomly select a word.
- Display the word with blanks for hidden letters.
- Allow the user to guess letters.
- Keep track of guessed letters and remaining attempts.
- Reveal letters in the word as they are guessed correctly.
- End the game when the word is guessed or attempts run out.
-
Tips:
Tip 1:
Use
random.choice()to select a random word from a list.Tip 2:
Use a
whileloop for the main game interactions.Tip 3:
Store guessed letters in a list to avoid repeat guesses and display them to the user.
Tip 4:
Represent the hidden word as a list of characters or underscores, updating it as letters are guessed.
Tip 5:
Keep a counter for incorrect guesses (attempts remaining).
-
Difficulty: 4.0/10
-
Description: A simple command-line contact manager.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/14_address_book.py
-
Steps:
- Create functions to add, view, and delete contacts.
- Store contacts in a file (e.g., JSON).
- Create a main loop to interact with the user.
-
Tips:
Tip 1:
Use a dictionary to store contact information.
Tip 2:
Use the
jsonmodule to save and load contacts from a file.
-
Difficulty: 3.0/10
-
Description: A time management tool to help you stay focused.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/15_pomodoro_timer.py
-
Steps:
- Create a function to run a countdown timer.
- Prompt the user for work and break durations.
- Alternate between work and break sessions.
-
Tips:
Tip 1:
Use the
timemodule to pause execution.Tip 2:
Use a loop to alternate between work and break sessions.
-
Difficulty: 4.5/10
-
Description: A tool to track your income and expenses.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/16_budget_tracker.py
-
Steps:
- Create functions to add income and expenses.
- Store transactions in a file (e.g., JSON).
- Calculate and display the current balance.
-
Tips:
Tip 1:
Use lists of dictionaries to store income and expense transactions.
Tip 2:
Use the
jsonmodule to save and load transaction data.
-
Difficulty: 3.5/10
-
Description: Create a script that organizes files in a directory into subfolders based on their file type (e.g., .txt files go into a "Text" folder, .jpg files go into an "Images" folder).
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/17_file_sorter.py
-
Steps:
- Prompt the user for the directory path to organize.
- Scan the directory for all files.
- For each file, get its extension (e.g.,
.txt,.jpg). - Create a subfolder corresponding to the file type if it doesn't already exist.
- Move the file into the appropriate subfolder.
- Display a summary of the actions taken.
-
Tips:
Tip 1:
Use the
osmodule to interact with the file system, such as listing files (os.listdir()), creating directories (os.mkdir()), and moving files (os.rename()).Tip 2:
The
pathlibmodule is a modern and more object-oriented alternative toos.pathfor handling filesystem paths.Tip 3:
Use a dictionary to map file extensions to folder names (e.g.,
{".txt": "Text", ".jpg": "Images"}).Tip 4:
Remember to handle cases where a file has no extension or you want to ignore certain files/directories.
-
Difficulty: 1.0/10
-
Description: Create a function that takes a string and returns it in reverse order.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/18_text_reverser.py
-
Steps:
- Prompt the user to enter a string.
- Create a function that takes the string as an argument.
- Inside the function, reverse the string.
- Return and display the reversed string.
-
Tips:
Tip 1:
Python's string slicing is a very concise way to reverse a string:
my_string[::-1].Tip 2:
You could also use a loop to iterate through the string from end to start and build the new string.
Tip 3:
Wrap your logic in a function to make it reusable.
-
Difficulty: 2.5/10
-
Description: Create a small program that asks multiple-choice questions from a predefined list and keeps score.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/19_simple_quiz_game.py
-
Steps:
- Create a list of questions, with options and the correct answer for each.
- Initialize a score variable to zero.
- Loop through the questions, displaying each one to the user.
- Prompt the user for their answer and check if it's correct.
- Update the score if the answer is correct.
- At the end of the quiz, display the final score.
-
Tips:
Tip 1:
Use a list of dictionaries to store your questions, where each dictionary contains the question, options, and the correct answer.
Tip 2:
Use a
forloop to iterate through your list of questions.Tip 3:
Keep track of the player's score in a variable that you increment for each correct answer.
-
Difficulty: 2.5/10
-
Description: Create a small program that finds and prints all prime numbers up to a user-specified limit.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/20_prime_number_generator.py
-
Steps:
- Prompt the user for an upper limit (a number).
- Create a function to check if a number is prime.
- Loop from 2 up to the user-specified limit.
- For each number, use your function to check if it's prime.
- Print all the numbers that are identified as prime.
-
Tips:
Tip 1:
A prime number is a number greater than 1 that has no positive divisors other than 1 and itself.
Tip 2:
To check if a number
nis prime, you only need to check for divisors up to the square root ofn.Tip 3:
Consider edge cases like 0, 1, and 2.
-
Difficulty: 2.0/10
-
Description: Create a function that generates the Fibonacci sequence up to a certain number of terms.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/21_fibonacci_sequence.py
-
Steps:
- Prompt the user for the number of terms to generate.
- Create a function that takes the number of terms as an argument.
- Generate the Fibonacci sequence up to that number.
- Return and display the sequence.
-
Tips:
Tip 1:
The Fibonacci sequence starts with 0 and 1. Each subsequent number is the sum of the two preceding ones (e.g., 0, 1, 1, 2, 3, 5, 8...).
Tip 2:
Use a loop and two variables to keep track of the last two numbers in the sequence to calculate the next one.
Tip 3:
Handle edge cases, such as a user requesting 0 or 1 term.
-
Difficulty: 1.5/10
-
Description: A simple tool that takes an email address and extracts the username and domain name.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/22_email_slicer.py
-
Steps:
- Prompt the user for an email address.
- Use string slicing to find the "@" symbol.
- Separate the string into a username and a domain.
- Display the results.
-
Tips:
Tip 1:
Use
input()to get user input. The.strip()method is useful for removing leading/trailing whitespace.Tip 2:
String indexing (e.g.,
email.index("@")) can find the position of a specific character.Tip 3:
Slicing (e.g.,
my_string[:5]) is a great way to extract parts of a string.
-
Difficulty: 1.5/10
-
Description: A program that calculates a person's Body Mass Index (BMI) based on their height and weight.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/23_bmi_calculator.py
-
Steps:
- Prompt the user for their weight (in kg) and height (in meters).
- Calculate the BMI using the formula:
weight / (height ** 2). - Display the calculated BMI.
- Provide a basic interpretation of the result (e.g., underweight, normal, overweight).
-
Tips:
Tip 1:
Use
float(input())to convert user input into a number that can have decimal points.Tip 2:
The power operator in Python is
**.Tip 3:
Use
if/elif/elsestatements to check the BMI range and provide the correct interpretation.
-
Difficulty: 2.5/10
-
Description: A simple tool to convert between a few currencies using fixed exchange rates.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/24_currency_converter.py
-
Steps:
- Define a dictionary with fixed exchange rates (e.g., relative to a base currency like USD).
- Prompt the user for the amount, the source currency, and the target currency.
- Perform the conversion calculation.
- Display the final converted amount.
-
Tips:
Tip 1:
A dictionary is a great way to store the currency exchange rates.
Tip 2:
To make the logic simpler, first convert the input amount to a common base currency (like USD), and then convert that base amount to the final target currency.
Tip 3:
Use the
.upper()method on the currency input from the user to make the dictionary lookup case-insensitive.
-
Difficulty: 3.0/10
-
Description: A simple command-line interface to add, view, and remove tasks from a list.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/25_task_tracker.py
-
Steps:
- Create functions to add, view, and delete tasks.
- Use a loop to keep the program running until the user exits.
- Display a menu of options to the user.
-
Tips:
Tip 1:
Use a list to store the tasks.
Tip 2:
Use
enumerate()to display the indices of the tasks for easier deletion.
-
Difficulty: 2.5/10
-
Description: A tool to convert between different units of length (meters to feet) and weight (kilograms to pounds).
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/26_unit_converter.py
-
Steps:
- Define conversion factors for different units.
- Prompt the user for the value and units to convert.
- Perform the conversion and display the result.
-
Tips:
Tip 1:
Use a dictionary to store conversion factors relative to a base unit.
Tip 2:
Use
float(input())to handle decimal values.
-
Difficulty: 1.5/10
-
Description: A program that determines if a given year is a leap year based on calendar rules.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Beginner/27_leap_year_checker.py
-
Steps:
- Prompt the user for a year.
- Apply the leap year logic (divisible by 4, but not by 100 unless divisible by 400).
- Display the result.
-
Tips:
Tip 1:
Use nested
ifstatements or logical operators to check the conditions.Tip 2:
Remember that years like 1900 were not leap years, but 2000 was.
Note
Working code solutions are in the /Beginner folder.
These projects are ideal for those with experience in Python. Each project includes a description, steps to follow, and tips for completing it.
-
Difficulty: 6.0/10
-
Description: Build a tic tac toe board, with it's own algorithm for winning and countering player moves.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/1_tic_tac_toe.py
-
Steps:
- Create the board (3x3 grid) and other logic (handling invalid moves, etc.)
- Handle player and computer moves, including ties, wins and losses.
- Display the board and start the game.
-
Tips:
Tip 1:
Use functions for repetitive tasks.
Tip 2:
Create an algorithm that not only chooses certain priority positions on the board, but also counters player moves.
Tip 3:
Add error handling and retries if a player chooses a place on the board that is already occupied.
-
Difficulty: 5.5/10
-
Description: An interactive fiction game where you can explore and make choices.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/2_adventure_game.py
-
Steps:
- Create a story with different rooms and choices.
- Use functions to represent different parts of the story.
- Get user input to navigate through the story.
-
Tips:
Tip 1:
Use a dictionary to define the game world, with rooms, descriptions, and choices.
Tip 2:
Use a loop to keep the game running until the player reaches an end state.
-
Difficulty: 8.5/10
-
Description: A program that can solve a partially completed Sudoku puzzle using a backtracking algorithm.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/3_sudoku_solver.py
-
Steps:
- Represent the Sudoku board (e.g., a 9x9 2D list, with 0 for empty cells).
- Create a function to find the next empty cell on the board.
- Create a function to check if placing a number in a cell is valid (obeys row, column, and 3x3 box rules).
- Implement the backtracking algorithm to recursively try numbers and solve the puzzle.
- Display the initial and solved boards.
-
Tips:
Tip 1:
Backtracking involves trying a possibility, seeing if it leads to a solution, and if not, undoing it (backtracking) to try another.
Tip 2:
A helper function like
is_valid(board, number, position)is essential for checking the rules of Sudoku.Tip 3:
Recursion is a natural fit for this problem. The base case for the recursion is when the board has no empty cells left.
-
Difficulty: 6.5/10
-
Description: Write your own functions to implement sorting algorithms like Bubble Sort, Selection Sort, or Insertion Sort.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/4_sorting_algorithms.py
-
Steps:
- Create a list of unsorted numbers.
- Implement a function for Bubble Sort.
- Implement a function for Selection Sort.
- Implement a function for Insertion Sort.
- For each algorithm, pass a copy of the unsorted list to the function and display the sorted result.
-
Tips:
Tip 1:
Bubble Sort: Repeatedly step through the list, compare adjacent elements, and swap them if they are in the wrong order.
Tip 2:
Selection Sort: Repeatedly find the minimum element from the unsorted part and put it at the beginning.
Tip 3:
Insertion Sort: Build the final sorted array one item at a time, inserting each new item into its proper place.
-
Difficulty: 5.0/10
-
Description: A program that uses the Sieve of Eratosthenes algorithm to efficiently find all prime numbers up to a given limit.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/5_prime_sieve.py
-
Steps:
- Prompt the user for an upper limit.
- Create a boolean list (a "sieve") of size
limit + 1, initially setting all entries toTrue. - Mark 0 and 1 as not prime (
False). - Iterate from 2 up to the square root of the limit. If a number is prime (still
True), mark all of its multiples as not prime (False). - Extract all numbers that are still marked as
Trueand display them.
-
Tips:
Tip 1:
The Sieve of Eratosthenes is much more efficient for finding all primes up to a limit than checking each number individually.
Tip 2:
You only need to iterate your main loop up to
sqrt(limit)because any composite numbernwill have a prime factor less than or equal tosqrt(n).
-
Difficulty: 4.5/10
-
Description: A program that can encrypt and decrypt a message using a simple shifting algorithm.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/6_caesar_cipher.py
-
Steps:
- Prompt the user for a message, a shift key (an integer), and whether to encrypt or decrypt.
- Create a function that takes the message, key, and mode as input.
- Inside the function, iterate through each character of the message.
- If the character is a letter, shift it by the key amount, wrapping around the alphabet if necessary (e.g., 'Z' shifted by 2 becomes 'B').
- Preserve the case (uppercase/lowercase) and leave non-alphabetic characters unchanged.
- Return and display the resulting message.
-
Tips:
Tip 1:
The modulo operator (
%) is perfect for handling the "wrap-around" logic for the alphabet.(char_position + shift) % 26.Tip 2:
The
stringmodule (string.ascii_lowercase,string.ascii_uppercase) can provide you with the alphabet, so you don't have to type it out yourself.Tip 3:
To decrypt, you can simply use the same function but with a negative shift key.
-
Difficulty: 5.5/10
-
Description: An object-oriented project using classes to simulate basic banking operations like deposits, withdrawals, and balance checks.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/7_bank_account.py
-
Steps:
- Define an
Accountclass with attributes for owner and balance. - Implement methods for
deposit,withdraw, and displaying account information. - Create a main loop to interact with the account.
- Define an
-
Tips:
Tip 1:
Use the
__init__method to initialize account attributes.Tip 2:
The
__str__method is useful for defining how the object should be printed.
-
Difficulty: 5.0/10
-
Description: A script that recursively walks through a directory and lists file names, sizes, and modification dates.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/8_file_metadata.py
-
Steps:
- Use the
os.walk()function to traverse the directory tree. - Use
os.stat()to retrieve metadata for each file. - Use the
timemodule to format the modification date.
- Use the
-
Tips:
Tip 1:
os.path.join()is the safest way to construct file paths across different operating systems.Tip 2:
time.ctime()is a quick way to convert a timestamp into a human-readable string.
-
Difficulty: 4.5/10
-
Description: A utility that reads data from a CSV file and converts it into a formatted JSON file.
-
Solution: https://github.com/Infinitode/Python-Projects/blob/main/Intermediate/9_csv_to_json.py
-
Steps:
- Use the
csvmodule to read data from a CSV file. - Store the data in a list of dictionaries.
- Use the
jsonmodule to write the list to a JSON file with indentation.
- Use the
-
Tips:
Tip 1:
csv.DictReaderis perfect for automatically using the CSV header as keys for your dictionaries.Tip 2:
Setting
indent=4injson.dump()makes the resulting JSON file much easier to read.
Note
Working code solutions are in the /Intermediate folder.
Contributions are welcome! If you have project ideas or improvements, feel free to fork the repository and open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.