Remakers - 3.13 Developing Procedures Python Hacks
Apply your skills to basic procedure development in Javascript.
Q1 (Easy)
Which of these procedures is named well, provide a short explanation of justification
def mix_ingredients():
# Wrong. This is vague
def do_it():
def make_move():
Explanation Here: __ is right because..
Q2 (Medium)
Finish the code to have a correctly named procedure
def step_turn_step():
move_forward()
rotate_180()
move_forward_again()
##Todo: add corresponding procedure definitions
def move_forward():
print("Moving forward.")
def rotate_180():
print("Rotating 180 degrees.")
def move_forward_again():
print("Moving forward again to complete left turn.")
# Run the procedure
if __name__ == '__main__':
step_turn_step()
Moving forward.
Rotating 180 degrees.
Moving forward again to complete left turn.
Q3 (Hard)
Write code to fulfill the requirements Doing a dance! πΊπ Must have
- A shimmy left procedure
- Print
super cool left slide
- Print
- A shimmy right procedure, print
even cooler right slide - Doing a bow to the crowd, print
Great dance!,the audience claps at your bow!
##Code away!
def shimmy_left():
print("Shifting left.")
def shimmy_right():
print("Shifting right.")
def bow_to_crowd():
print("Great dance!")
print("The audience claps at your bow!")
def doing_dance():
shimmy_left()
shimmy_right()
bow_to_crowd()
doing_dance()
Shifting left.
Shifting right.
Great dance!
The audience claps at your bow!