a = ["Hello", "World", 42]

"""
Explanation: Python basics
Objects, dir, help

Everything in Python is an object
Objects have attributes
Use TAB for autocompletion

Example: a list
End of explanation
"""


dir(a)

"""
Explanation: Type a., then press tab to see attributes:
Alternatively, use the dir(a) command to see the attributes (ignore everything starting with __):
End of explanation
"""


help(a.append)

"""
Explanation: Imagine we want to find out what the append attribute is: use help(a.append) or a.append? to learn more about an attribute:
End of explanation
"""


print(a)

a.append("New element")

print(a)

"""
Explanation: Let's try this:
End of explanation
"""


d = 20e-9   # distance in metres

"""
Explanation: Comments
Anything following a # sign is considered a comment (to the end of the line)
End of explanation
"""


import math
math.sin(0)

"""
Explanation: Importing libraries
The core Python commands can be extened through importing additonal libraries.
import syntax 1
End of explanation
"""


import math as m
m.sin(0)

"""
Explanation: import syntax 2
End of explanation
"""


def greet(greeting, name):
    """Optional documentation string, inclosed in tripple quotes.
    Can extend over mutliple lines."""
    print(greeting + " " + name)

greet("Hello", "World")

greet("Bonjour", "tout le monde")

"""
Explanation: Functions
A function is defined in Python using the def keyword. For example, the greet function accepts two input arguments, and concatenates them to become a greeting:
End of explanation
"""


greet(greeting="Hello", name="World")

greet(name="World", greeting="Hello")

"""
Explanation: In above examples, the input argument to the function has been identified by the order of the arguments. 
In general, we prefer another way of passing the input arguments as 
- this provides additional clarity and 
- the order of the arguments stops to matter.
End of explanation
"""


def say_hello(name):             # function
    print("Hello " + name)

# main program starts here
names = ["Landau", "Lifshitz", "Gilbert"]
for name in names:
    say_hello(name=name)

"""
Explanation: Note that the names of the input arguments can be displayed intermittently if you type greet( and then press SHIFT+TAB (the cursor needs to be just to the right of the opening paranthesis).
A loop
End of explanation
"""


