This repository documents my progress in the 100 Days of Code challenge, following the Udemy course 100 Days of Code - The Complete Python Pro Bootcamp for 2021.
- Day 1 - Working with Variables in Python to Manage Data
- Day 2 - Understanding Data Types and How to Manipulate Strings
- Day 3 - Control Flow and Logical Operators
- Day 4 - Randomisation and Python Lists
- Day 5 - Beginner Python Loops
- Day 6 - Mastering Python Functions & Navigating Complex Courses with Karel
- Day 7 - Hangman
- Day 8 - Function Parameters & Caesar Cipher
- Day 9 - Dictionaries, Nesting and the Secret Auction
- Day 10 - Functions with Outputs
- Day 11 - The Blackjack Capstone Project
- Day 12 - Scope & Number Guessing Game
- Day 13 - Debugging: How to Find and Fix Errors in your Code
- Day 14 - Higher Lower Game Project
- Day 15 - Setting Up IDE & Coffee Machine Program
- Day 16 - Object Oriented Programming (OOP)
- Day 17 - The Quiz Project & the Benefits of OOP
- Day 18 - Turtle & Graphical User Interface (GUI)
- Day 19 - Instances, State and Higher Order Functions
- Day 20 - Build the Snake Game Part 1 - Animation & Coordinates
- Printing Hello World:
- Introduced to the basic syntax of printing in Python.
- Explored different approaches to printing multiline strings.
- String Manipulation:
- Learned about string concatenation and escape characters.
- Explored various ways to manipulate strings in Python.
- Debugging Practice:
- Fixed errors in a code snippet related to string manipulation.
- Input Function:
- Explored the use of the
inputfunction to take user input.
- Explored the use of the
- Length of a String:
- Wrote a program to calculate and output the number of characters in any name.
- Swap Variables:
- Created a program to switch the values stored in two variables.
- Band Name Generator:
- Developed a simple Band Name Generator using user input for city and pet names.
- Subscripting:
- Demonstrated the method of pulling out a particular element from a string.
- Type Checking and Conversion:
- Explored type checking using the
typefunction. - Demonstrated type conversion between string, int, and float.
- Explored type checking using the
- Add digits in a number:
- Wrote a program to add the digits in a 2-digit number.
- Mathematical Operations:
- Covered basic mathematical operations in Python.
- Explained the order of operations (PE(MD)(AS)).
- BMI Calculator:
- Created a program to calculate Body Mass Index (BMI) from user input.
- Additional Mathematical Operations:
- Demonstrated rounding and floor division.
- f-String:
- Introduced the use of f-strings for string formatting.
- Life in Weeks:
- Calculated and displayed the number of weeks left based on the user's age.
- Tip Calculator:
- Developed a program to calculate the bill per person, including a specified tip.
- Rollercoaster Height Checker:
- Implemented a Python program that greets users entering a rollercoaster and checks whether they meet the height requirement.
- Odd or Even Number:
- Created a program that determines if a given number is odd or even.
- BMI 2.0:
- Developed a program that interprets the Body Mass Index (BMI) based on a user's weight and height.
- Leap Year:
- Wrote a program that determines if a given year is a leap year.
- Python Pizza Order:
- Implemented an automatic pizza order program based on user choices for pizza size, pepperoni, and extra cheese.
- Love Calculator:
- Developed a program to test compatibility between two people based on the occurrence of specific letters in their names.
- Text-based Adventure Game:
- Created a text-based adventure game where the player makes choices leading to different outcomes.
- Randomization:
- Introduced the use of the
randommodule in Python. - Demonstrated generating random integers and floating-point values.
- Introduced the use of the
- Coin Toss Program:
- Implemented a virtual coin toss program using random numbers.
- Banker Roulette:
- Developed a program to randomly select a person from a list for paying a food bill.
- Lists and Nested Lists:
- Explored the concept of lists in Python, including basic operations and nested lists.
- Treasure Map:
- Created a program that marks a spot on a map with an "X" based on user input.
- Rock, Paper, Scissors Game:
- Implemented a simple rock, paper, scissors game with ASCII art.
-
For loop - do something to each item:
- Introduced the concept of a for loop in Python.
- Illustrated how indentation is crucial in defining the scope of the for loop.
-
Average Height:
- Wrote a program that calculates the average student height from a list of heights without using
sum()orlen()functions.
- Wrote a program that calculates the average student height from a list of heights without using
-
High Score:
- Developed a program to find the highest score from a list of scores without using
max()function.
- Developed a program to find the highest score from a list of scores without using
-
Adding Even Numbers:
- Created a program to calculate the sum of all even numbers from 1 to X.
-
FizzBuzz Game:
- Implemented the FizzBuzz game rules, printing numbers from 1 to 100 with specific conditions for multiples of 3, 5, or both.
-
Password Generator: Easy Version:
- Developed a password generator that takes user inputs for the number of letters, symbols, and numbers, generating a password with a specific sequence.
-
Password Generator: Hard Version:
- Enhanced the password generator to randomize the order of letters, symbols, and numbers in the generated password.
-
Introduction to Functions:
- Learned about defining functions in Python using the
defkeyword followed by the function name and core logic indented. - Understood the importance of indentation and the preferred method of using spaces over tabs according to the official Python documentation.
- Learned about defining functions in Python using the
-
Hurdles Race 1:
- Solved a hurdles race challenge using Python functions
move()andturn_left()to navigate Reeborg through a predefined path. - Recognized repeated patterns in the solution and defined a function named
jump()to simplify the program.
- Solved a hurdles race challenge using Python functions
-
Hurdles Race 2:
- Addressed a hurdles race challenge where the length of the race was not known in advance.
- Implemented a solution using a
whileloop and theat_goal()function to navigate through the race course.
-
Hurdles Race 3:
- Tackled a hurdles race challenge with changing positions and numbers of hurdles.
- Used a combination of
whileloop andifstatement with functions likefront_is_clear()andat_goal()to navigate Reeborg through the course.
-
Hurdles Race 4:
- Faced a hurdles race challenge with varying positions and heights of hurdles.
- Developed a solution using functions like
wall_on_right()andwall_in_front()along with loops and conditional statements to navigate Reeborg through the course.
-
Lost in a Maze:
- Encountered a maze exploration challenge where Reeborg's flashlight battery ran out.
- Implemented an
if/elif/elsestatement logic to guide Reeborg along the right edge of the maze towards the exit.
-
Hangman 1 :
- Write a program that selects a word from a list, prompts the user to guess a letter, and checks if the guessed letter is in the chosen word. Make sure to account for letter case.
-
Hangman 2:
- Given a randomly chosen word from a list, prompt the user to guess a letter. Then, reveal if the guessed letter is correct and update the display to show the guessed letter in its correct position within the word.
-
Hangman 3:
- Guess all the letters in a randomly chosen word. With each correct guess, reveal the letters in their correct positions. Use a while loop to keep guessing until you've uncovered all the letters and filled in all the blanks ('_').
-
Hangman 4:
- Guess the letters of a randomly chosen word. Each incorrect guess will take away one of your six lives. If you lose all your lives, the game ends. Can you guess all the letters before running out of lives?
-
Hangman 5:
- Implement the Hangman game in Python using a list of words. Players should be able to guess letters until they either win or lose. The program should provide appropriate feedback for correct and incorrect guesses, and it should also keep track of the remaining lives.
-
Function Definition and Calling:
- Learned how to define functions with and without parameters using the
defkeyword. - Explored different ways of calling functions with and without arguments.
- Learned how to define functions with and without parameters using the
-
Parameter Passing:
- Understood the concept of function parameters as placeholders for data that can be passed during function invocation.
- Explored the distinction between formal parameters (defined in the function signature) and actual arguments (passed during function call).
-
Function Modularity:
- Recognized the benefits of modularizing code using functions with parameters, enabling code reuse and enhancing readability.
-
Caesar Cipher Encryption and Decryption:
- Explored the implementation of the Caesar cipher encryption and decryption algorithms.
- Learned how to shift characters in the alphabet to encode and decode messages.
-
User Interaction in Functions:
- Incorporated user input and interaction within functions to enhance the versatility and usability of the Caesar cipher program.
-
Looping Constructs for Game Control:
- Implemented looping constructs to enable repeated encryption/decryption tasks based on user input.
- Used while loops to maintain program execution until the user decides to exit.
-
Dictionary Basics:
- Introduced the concept of dictionaries in Python as key-value pairs.
- Demonstrated adding items to a dictionary and looping through its keys.
-
Scoring Criteria Program:
- Implemented a program to convert exam scores to grades based on predefined criteria.
- Created a new dictionary,
student_grades, containing student names as keys and their corresponding grades as values.
-
Nested Dictionaries and Lists:
- Explored nested data structures, such as dictionaries containing lists.
- Illustrated how to access and manipulate data within nested structures.
-
Adding Entries to a Travel Log:
- Developed a function to add new entries for countries visited to a travel log, without directly modifying the log.
- Utilized function parameters to accept country name, number of visits, and a list of cities visited.
-
Secret Auction Program:
- Designed a Python program for a secret auction, prompting bidders for their name and bid amount.
- Determined the winner based on the highest bid and printed their name along with the winning bid amount.
-
Leap Year and Days in Month:
- Modified
is_leap()to returnTruefor leap years, and developeddays_in_month()to calculate days based on input year and month.
- Modified
-
Simple Calculator Program:
-
Blackjack Game Rules:
- Familiarize yourself with the rules of Blackjack, including the objective of having a hand value as close to 21 as possible without exceeding it.
- Understand the values of different cards, including face cards and Aces, and how they contribute to the hand value.
- Learn about the conditions for winning, losing, or drawing in a Blackjack game.
-
Python Implementation:
- Explore the Python code provided for implementing a simplified version of Blackjack.
- Understand the functions for dealing cards, calculating the sum of a hand, and simulating a single game of Blackjack between a player and a dealer.
- Recognize the logic for player decisions, such as whether to get another card or pass, and the dealer's actions based on their hand value.
-
Simulation and Outcome:
- Gain insights into how the Blackjack game simulation works, including dealing initial cards, player decisions, dealer actions, and determining the outcome of the game.
- Understand the final hand comparison and the conditions for declaring the winner or a draw.
- Explore the use of loops, conditional statements, and functions in the implementation of the Blackjack game in Python.
-
Local vs. Global Scope:
- Understand the distinction between local and global scope in Python.
- Note that Python lacks block scope.
-
Game Objectives:
- Create a Number Guessing Game with the following features:
- Include an ASCII art logo.
- Allow the player to submit guesses for a number between 1 and 100.
- Provide feedback on guesses, indicating whether they are too high or too low.
- Track the number of turns remaining and provide appropriate feedback if the player runs out of turns.
- Implement two difficulty levels: easy and hard, with different numbers of allowed guesses.
- Create a Number Guessing Game with the following features:
-
Enhanced Visuals:
- Describing the Problem and Debugging Strategies:
- Learned the importance of describing the problem and untangling complex issues.
- Explored various debugging strategies such as reproducing the bug, using print statements, utilizing debuggers, taking breaks, seeking external perspectives, running code often, and consulting resources like Stack Overflow.
- Higher Lower Game Project:
-
IDE Setup:
- Explored PyCharm as an example of an IDE, highlighting its features like spell check, linting, version history, and code execution within one interface.
-
Coffee Machine Program:
- Developed a Python program simulating a coffee machine:
- Prompted users to select a drink and turned off the machine with "off" command.
- Generated reports of current resource values.
- Checked resource availability for selected drinks.
- Processed inserted coins and handled successful transactions.
- Dispensed drinks, updated resources, and tracked profits.
- Developed a Python program simulating a coffee machine:
-
Key Elements:
-
Object-Oriented Programming (OOP) Basics:
- OOP involves organizing code around objects, which have attributes (properties) and methods (behaviors).
- Objects are instances of classes, which act as blueprints defining the structure and behavior of objects.
- Classes are named in PascalCase, and attributes and methods are accessed using dot notation (
object.attributeorobject.method()).
-
Application of OOP in Coffee Machine Program:
- Refactored the Coffee Machine Program using OOP principles.
- Utilized these classes to create an interactive coffee machine program that allows users to select drinks, checks resource availability, processes payments, and dispenses drinks.
-
Object-Oriented Programming (OOP) Principles:
- Explored the fundamentals of OOP, where classes act as blueprints for creating objects with attributes and methods.
- Defined a
Questionclass to represent quiz questions, with attributes for text and answer, and a method to check user answers. - Created a
Quizclass to manage a quiz session, initializing questions, tracking scores, and presenting questions to users. - Demonstrated the use of constructors (
__init__method) to initialize object attributes and ensure proper object instantiation.
-
Encapsulation and Modularity:
- Leveraged encapsulation to bundle related data (question text and answer) and behavior (checking answers) within the
Questionclass. - Achieved modularity by separating quiz logic into a dedicated
Quizclass, promoting code organization, reusability, and maintainability. - Illustrated the benefits of encapsulation and modularity in enhancing code clarity, reducing redundancy, and facilitating collaborative development.
- Leveraged encapsulation to bundle related data (question text and answer) and behavior (checking answers) within the
-
Creative Visualization with Turtle Module:
- Explored the versatility of the Turtle module for graphical visualization in Python.
- Demonstrated drawing basic shapes like squares, lines, and polygons with precise control over movement and angles, showcasing the power of procedural graphics programming.
-
Dynamic Graphic Generation with Random Walks and Spirographs:
- Implemented dynamic graphic generation using random walks and spirographs, showcasing the ability to create complex and visually appealing patterns with simple code.
- Leveraged randomness to create unique and intricate designs, highlighting the fusion of mathematical concepts with artistic expression in programming.
-
Etch Sketch App Development:
- Created an Etch Sketch application using the Turtle module in Python.
- Implemented event listeners to capture keyboard inputs for controlling the drawing movements.
- Utilized functions to move the turtle forward, backward, rotate clockwise, and counterclockwise based on user inputs.
- Demonstrated the concept of instances and state by maintaining the position and orientation of the turtle throughout the drawing process.
-
Turtle Racing Game Development:
- Developed a turtle racing game utilizing the Turtle module and random number generation in Python.
- Created a user interface for placing bets on the winning turtle.
- Initialized multiple turtle instances with different colors and starting positions to simulate a race.
- Implemented a while loop to control the race progress, updating turtle positions randomly until one turtle crosses the finish line.
- Incorporated conditional statements to determine the winner based on user input for the winning turtle color.
-
day-19-sample-turtle-race-recording.mp4
- Snake Game Initialization:
-
Developed the foundational elements of the Snake game, including creating the snake body segments, defining movement functions, and setting up user input for controlling the snake's direction.
-
These points cover the setup and basic functionalities of the Snake game, setting the stage for further development and enhancement in subsequent parts.
-






