#100DaysOfCode: Python Day 6

#100DaysOfCode: Python Day 6

Functions & While Loops

⬆️⬇️⬅️➡️I SOLVED REEBORG.CA's MAZE CHALLENGE! ⬆️⬇️⬅️➡️
CLICK HERE to try and solve it too.
Screenshot 2021-05-16 at 23.00.15.png

Yesterday I learned how to create function and use while loops 🔁.
Again it was Sunday when I wrote this code and surprisingly, this code got me excited and ready to take on today (Monday)!

Lessons

  1. As the code becomes more complex, INDENTATION IS EVERYTHING!
    Click here to read the style guide for Python code.

TO THE CODE!!!

functions.py

# Functions 

# Built-in Functions
# https://docs.python.org/3/library/functions.html

# Syntax to define your function
# def my_function():
#     #Do this
#     #Then do this
#     #Finally do this

# Making our own function 
def my_function():
    print("Hello")
    print("Bye")

# If I run my code right now, nothing would happen
# We have to call our function
my_function()
# OUTPUT:
# Hello
# Bye

whileLoops.py - basic "while loop"

# While loop

# while something_is_true
#     #Do something repeatedly

number_of_hurdles = 6
while number_of_hurdles > 0:
    print("I have jumped!")
    number_of_hurdles -= 1

# Be careful about infinite loops (Condition will always be true)
# while 5 > 3:
#     print("5 > 3")

There is some level of satisfaction when you get a bot to navigate a maze. I guess it may be similar to the feeling of teaching your child to walk 🚼 ➡️ 🏃‍♂️...
I know thats a horrible comparison, you can show me flames in the comments 🔥😜!

Have a super week 🚀!!!