Assignment if_elif_else_while_D
- start at (0,0)
- end at (0,23)
- use 1 loop
- pick up the 1 flower and use the following while loo
Use this code at the start of your program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
tim = Jeroo() while not ( tim. isWater(AHEAD) and tim.hasFlower() ) : if tim.isFlower(AHEAD) : tim.hop() tim.pick() elif not tim.isClear(AHEAD) : tim.turn(RIGHT) tim.hop() tim.turn(LEFT) tim.hop(2) tim.turn(LEFT) tim.hop() tim.turn(RIGHT) else : tim.hop() |
The map
What the map and Jeroo looks like at the completion of the loop
1 |