### 2-3 code ###

def helloWorld():
    print("Hello, world!")
    print("How are you?")

helloWorld()
helloWorld()
helloWorld()

def hello(name):
    print("Hello,", name)
    print("How are you?")

hello("Franceska")
hello("Alice")

def sayHello(name):
    return "Hello, " + name + ". How are you?"

print(sayHello("Franceska") + " I'm doing fine!")

###

def convertToQuarters(dollars):
    return dollars*4

print(convertToQuarters(2))

###

def distance(x1, y1, x2, y2):
    xPart = (x2 - x1)**2
    yPart = (y2 - y1)**2
    print("Partial Work:", xPart, yPart)
    return (xPart + yPart) ** 0.5

result = distance(0, 0, 3, 4)

# arguments: 0, 0, 3, 4
# returned value: 5.0

###

name = "Farnam" # global

def greet(day): # day is local to greet
    punctuation = "!" # local to greet
    print("Hello, " + name + punctuation)
    print("Today is " + day + punctuation)

def leave():
    punctuation = "." # local to punctuation
    print("Goodbye, " + name + punctuation)

greet("Monday")
leave()

###

def outer(x):
    y = x / 2
    return inner(y) + 3

def inner(x):
    y = x + 1
    return y

print(outer(4))