Remakers - 3.13 Developing Procedures Python Hacks
Categories: PythonApply 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():
def do_it():
def make_move():
Explanation Here:
mix_ingredients() is right because it clearly describes what the procedure does. Good procedure names are specific and meaningful, helping others understand the code’s purpose without reading its details.
Q2 (Medium)
Finish the code to have a correctly named procedure
def move_forward():
print("Moving forward.")
def rotate_180():
print("Turning left")
def move_forward_again():
print("Moving forward again to complete left turn.")
def make_left_turn():
move_forward()
rotate_180()
move_forward_again()
if __name__ == '__main__':
make_left_turn()
Moving forward.
Turning left
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("super cool left slide")
def shimmy_right():
print("even cooler right slide")
def bow_to_crowd():
print("Great dance!")
print("the audience claps at your bow!")
if __name__ == '__main__':
shimmy_left()
shimmy_right()
bow_to_crowd()
super cool left slide
even cooler right slide
Great dance!
the audience claps at your bow!