Part 1 Turtle Graphics (cont.)
Draw the following two figures with Python Turtle.
Part 2 Selection
What is the difference between the following two functions?
def foo(): if True: if False: print(1) else:
print(2)
def foo(): if True: if False: print(1) else:
print(2)
Part 3 Repetition
Part 4 Functions
Nowadays, we can make customizations when we order food. For example, you can order your burger with extra or no cheese. A burger is represented by a string consisting of its ingredients as follows:
β βBβ stands for a piece of bun
β βCβ stands for cheese
β βPβ stands for patty
β βVβ stands for veggies
β βOβ stands for onions
β βMβ stands for mushroom
Examples:
β’ A simple burger
β’ βBVPBβ
β’ A double cheese burger
β’ βBVCPCPBβ
β’ This one?
β’ βBPVBPVCBβ
The price of each ingredient is given:
Ingredient Price
βBβ stands for a piece of bun $0.5
βCβ stands for cheese $0.8
βPβ stands for patty $1.5
βVβ stands for veggies $0.7
βOβ stands for onions $0.4
βMβ stands for mushroom $0.9
Your task is to write a function burgerPrice(burger) that takes in a string representing a burger and returns the price of the burger. For example:
>>> burgerPrice(βBVPBβ)
3.2


