Advertisement
brilliant_moves

DirectionsToHome.py

Apr 12th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. #!/usr/bin/python
  2. #Python 2.7
  3.  
  4. # make list to store destination
  5. name = []
  6. # So that the starting of the loop would always be home
  7. name.append("your HOME")
  8. #make list to store direction
  9. new = []
  10. # Go through 5 times
  11. for i in range (5):
  12.     #i = 1
  13.     # Get the inputs
  14.     direction = raw_input ("Enter Direction (left/right): ")
  15.     # Set the direction to be in letters
  16.     if direction in ("L", "l", "left"):
  17.         result = "Turn right"
  18.     if direction in ("R", "r", "right"):
  19.         result = "Turn left"
  20.  
  21.     destination = raw_input ("Enter Destination: ")
  22.     # When school is inputted stop the loop
  23.     if destination.upper() == "SCHOOL":
  24.         break
  25.     # Add to the list all destination inputs
  26.     name.append (destination + " street")
  27.  
  28.  
  29.     # Add all directions
  30.     new.append(result)
  31.  
  32. # Reverse the list for the destination
  33. # Reverse the list for the direction
  34.  
  35. new = new[::-1]
  36. name = name[::-1]
  37.  
  38. for i in range (len(name)):
  39.     print new[i-1]+" into "+name[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement