while-if-elif-else Jeroo[Python]

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

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

if_elif_else_while_D_BEFORE

What the map and Jeroo looks like at the completion of the loop

if_elif_else_while_D_AFTER_2