Day 6 of 100 Days of Code: Functions, Loops, and Robot Mazes 🤖🔁
I’m excited to share my journey on Day 6️⃣ of the 100 Days of Code Challenge. Today was all about diving deeper into Python by exploring functions, code blocks, while loops, and an exciting robot maze project.
Goals for the Day: 🎯
- Master Python functions, code blocks, and while loops.
- Create a robot and maze project featuring Karel the Robot.
Key Concepts Covered:
Defining and Calling Python Functions:
- Understanding how to define and call functions is essential in Python. Functions help in organizing code into reusable blocks, making it easier to manage and debug. Here’s a simple example:
The Hurdles Loop Challenge:
- This part involved creating loops to navigate hurdles. It was a great exercise in applying loops to solve problems efficiently.
Indentation in Python:
- Indentation is crucial in Python as it defines the structure of the code. Proper indentation ensures that the code is readable and logically structured.
We also learned the differences between spaces and tabs and how to avoid common indentation errors.
Quiz 5: Indentation Quiz
To reinforce our understanding, we completed a quiz on indentation, which was both challenging and insightful.
While Loop:
- While loops are used to execute a block of code as long as a condition is true. They are powerful for tasks that require repeated execution until a condition changes.
Hurdles Challenge using While Loops:
- This challenge involved using while loops to navigate hurdles, similar to the previous challenge but with more control and flexibility.
Jumping Over Hurdles with Variable Heights:
- We took the hurdles challenge further by introducing variable heights, making the problem more dynamic and interesting to solve.
Final Project — Escaping The Maze
The highlight of the day was creating a project where Karel the Robot escapes a maze. This project brought together everything we learned about functions and loops.
Replit: https://replit.com/@mbaig9/Day6100DaysofPython-MMB-Maze#Day6Exercises/V67D6FINALPROJECTROBOTMAZE.py
Github: https://github.com/M1RZAB4IG/100DaysofPythonCodeChallenge/blob/main/Day6-RobotMaze.py
Reeborg Website: https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Maze&url=worlds%2Ftutorial_en%2Fmaze1.json
Summary:
Day 6 was a deep dive into functions, loops, and solving problems with Python. The challenges were tough but rewarding, and the final project of escaping the maze was a perfect way to apply everything learned. ✅
#Python #Coding #100DaysofPythonChallenge #Learning #Programming #Functions #Loops #Replit #Medium #SoftwareDevelopment
Stay tuned for more updates as I continue my coding journey!👣
Feel free to connect and share your own coding journey! 🚀💻🐍