Functions are block of codes, it works when called in. We create a new function by using
def, anything indented under it will be performed.
It's the space before the line of code. This incdicates a set or block of codes. Python executes the indented blocks of code when the function is called later in the program.
# this how we create a new function def bootcamp(): # the space before the print statement is indentation print("Hello, Python World!") bootcamp()
Hello, Python World!
while loops work as when some condition is true then it perfoms the loop.
i = 1 # while checks for the condition and run until it goes to FALSE while i < 5 print(i) i += 1
1 2 3 4
All of today's challenges was based on Hurdle game on Reeborg's World. It gave a good idea on how function works and we can use loops and if/elif/else to do small tasks using different function.
Description: This is a game on Reboorg's World. Escaping the Maze
My Solution: escaping_the_maze.py
note: the above code has some bugs, has to debugged after completing a few more day's lesson.