cwisbg

Luncher_v2

Feb 2nd, 2012
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. """___________________
  2.    Lunch Picker
  3.    Version_0.3
  4.    
  5.    cwisbg
  6.    Brandon Gillespie
  7.    1/30/2012
  8. ______________________      
  9. """
  10. from datetime import datetime
  11. import random as r
  12.  
  13. times = str(datetime.now()) # Get system time/date
  14.  
  15. weekDays = ['Monday','Tuesday','Wednesday','Thursday','Friday']
  16. title = "You will have"
  17. dataPath = "E:/"
  18. # Get lunch ideas
  19. lunchIdeas = open("{0}lunchIdeas.txt".format(dataPath), "r")
  20. readLunchIdeas = lunchIdeas.readlines()
  21. # Make used choices file
  22. openlunchData = open("{0}lunchData.txt".format(dataPath), "a+")
  23. lunchData = openlunchData.readlines()
  24. # Make Lunch Menu
  25. openMenu = open("{0}lunchMenu.txt".format(dataPath), "w+")
  26. menu = openMenu.readlines()
  27.  
  28.  
  29. currentLunchList = []
  30.  
  31.  
  32. z = 0 # Zero start incramentor
  33.  
  34.  
  35. # load up currentLunch list with lunch ideas
  36. if len(lunchData) <= 0:
  37.     pass
  38. else:
  39.     for i in readLunchIdeas:
  40.         if z == len(lunchData):
  41.             pass
  42.         else:              
  43.             if i == lunchData[z]:
  44.                 z += 1
  45.             else:
  46.                 currentLunchList.append(i)
  47.             z += 1
  48.  
  49.  
  50. if len(lunchData) <= 0:
  51.     for i in range(0,len(weekDays)):
  52.         rando = r.randint(0,len(readLunchIdeas))
  53.         menu.append(readLunchIdeas[rando])
  54. # Ittorate thought the week
  55. else:
  56.     for i in range(0,len(weekDays)):
  57.         rando = r.randint(0,len(currentLunchList))
  58.         menu.append(currentLunchList[i])
  59.  
  60. #print menu
  61. for i in menu:
  62.     openlunchData.write(i)
  63.     openMenu.write(i)
  64. lunchIdeas.close()
  65. openlunchData .close()
  66. openMenu.close()
Advertisement
Add Comment
Please, Sign In to add comment