Notes

def main(food):
  print(food)

Python Indentation

Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.

Python uses indentation to indicate a block of code.

Variable

In Python, variables are created when you assign a value to it

Casting

You can specify the data type of a variable

str()
int()
float()

Get the type

x = 5
print(type(x))

Global Keyword

To create a global variable inside function

def myFunc()
  global x

Data Built in Types

Python has the following data types built-in by default, in these categories:

Text Type: str Numeric Types: int, float, complex Sequence Types: list, tuple, range Mapping Type: dict Set Types: set, frozenset Boolean Type: bool Binary Types: bytes, bytearray, memoryview None Type: NoneType

Multiline string

three single quotes or three double quotes

To get length of list

len(your_list)
  • Function does not need end
  • else if also doesnt need end

https://automatetheboringstuff.com/2e/chapter5/ https://www.w3schools.com/python/python_lists_loop.asp