Indentation:
def my_function():
print("Hello")
Spaces vs. Tabs
PEP 8 -- Style Guide for Python Code | Python.orghttps://www.python.org/dev/peps/pep-0008/
While loops
What about the for loop:
for item in list_of_items:
#Do something to each item
for number in range(a,b):
print(number)
While
while something_is_true
#Do something repeatedly
while +condintion:
Infinite loop
if you don't know why it is an infinite loop, just print the condition.
def turn_right():
turn_left()
turn_left()
turn_left()
def jump():
turn_left()
while front_is_clear() and wall_on_right():
move()
turn_right()
move()
turn_right()
move()
while front_is_clear() and wall_on_right():
move()
turn_left()
while not at_goal():
if front_is_clear():
move()
elif wall_in_front():
jump()
成功啦!!!