# Solutions to suggested exercises -- Python review 1B

# 1.  String expressions

s1 = "a5d"
s2 = "7z"
s3 = "elephant"


# 'print' is not required unless we want to see the
# result

# Other solutions are possible for at least some of these.

print(s1[0]) # 'a'
print(s1[0] + s2[1]) # 'az'
print(3 * s1) # 'a5da5da5d'
print(s3[:3]) # 'ele'
print(s3[1:5]) # 'leph'
print(s3[3:]) # 'phant'


# 2.  Define function with optional argument

def foo(a, b, c=0):
    return 2 * a**2 + 3 * b + c

# 3.  Call it

print(foo(10, 9))

print(foo(10, 9, 5))

print(foo(10, 9, c=7))
