Day 6: 100 Days of Code

Day 6: 100 Days of Code

Python

I have learned code blocks, Indentation, Function and While loop today.

Functions

There are two types of functions built-in functions and our own functions. Beloved's is the example of defining and calling the function in python.

#Define your function
def my_function():
    print("Hello")
    print("Bye")

  #Call the function
my_function()

While Loop

while loop is used where we know the particular condition that is going to be true or false. However, the question is when to use for loop and when to use while loop. For loop: When we have to iterate through 1) list or 2) have range(a , b). (Two flavors of for loop) While loop: When we have some sort of condition to be true.

Indentation

We use four spaces for the indentation in python. Some programmer do use spaces and some use tab as an indentation. Most of them prefer to use spaces.

Four hurdles of Reeborg's world is solved as an exercises on day 6 and Escaping the Maze was today's project.

Headover to my GitHub 100DaysOfCode repository for exercises and project solutions.