Programming Tutorial 2 (V1)
Programming Tutorial 2 (V1)
Summary
Today’s topics How they look like
Escape character \n
if if if
Conditional statement if else elif
elif
else
def function1():
print("Output line 1")
print("Output line 2")
print("Output line 3")
def function2():
print("Output line 4")
print("Output line 5")
print("Output line 6")
# function call
function1()
function2()
Q4: The following codes are a bit messy. Rearrange
them into 2 functions called printColors() and
printFoods().
print("Burger")
print("Cabbage")
print("Red")
print("Cyan")
print("Pizza")
print("Red Velvet cake")
print("Blue")
print("Coquelicot")
Q5: Draw a flowchart of the following code.
# Code here
print("Hello world")