daily pastebin goal
5%
SHARE
TWEET

DC Rev

a guest Oct 19th, 2017 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #Program written by Dan Cartwright, Built just for fun aha, enjoy :)
  2. import time
  3. import sys
  4. ppl = open("testData.txt","r")
  5. pplx = ppl.readlines()
  6.  
  7.  
  8.  
  9. def days_1():
  10.  
  11.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  12.     for line in pplx:
  13.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  14.         Wind_Speed = int(Wind_Speed)
  15.         Temperature = float(Temperature)
  16.         if Day == "Monday":
  17.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  18.             print("============================================================")
  19.  
  20. def days_2():
  21.  
  22.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  23.     for line in pplx:
  24.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  25.         Wind_Speed = int(Wind_Speed)
  26.         Temperature = float(Temperature)
  27.         if Day == "Tuesday":
  28.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  29.             print("============================================================")
  30.  
  31. def days_3():
  32.  
  33.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  34.     for line in pplx:
  35.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  36.         Wind_Speed = int(Wind_Speed)
  37.         Temperature = float(Temperature)
  38.         if Day == "Wednesday":
  39.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  40.             print("============================================================")
  41. def days_4():
  42.  
  43.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  44.     for line in pplx:
  45.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  46.         Wind_Speed = int(Wind_Speed)
  47.         Temperature = float(Temperature)
  48.         if Day == "Thursday":
  49.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  50.             print("============================================================")
  51.  
  52. def days_5():
  53.  
  54.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  55.     for line in pplx:
  56.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  57.         Wind_Speed = int(Wind_Speed)
  58.         Temperature = float(Temperature)
  59.         if Day == "Friday":
  60.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  61.             print("============================================================")
  62.  
  63. def days_6():
  64.  
  65.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  66.     for line in pplx:
  67.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  68.         Wind_Speed = int(Wind_Speed)
  69.         Temperature = float(Temperature)
  70.         if Day == "Saturday":
  71.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  72.             print("============================================================")
  73. def days_7():
  74.  
  75.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  76.     for line in pplx:
  77.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  78.         Wind_Speed = int(Wind_Speed)
  79.         Temperature = float(Temperature)
  80.         if Day == "Sunday":
  81.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  82.             print("============================================================")  
  83.  
  84.  
  85.  
  86. def option_1():
  87.  
  88.     print("|DAY|\t   |TIME| |TEMPERATURE| |WIND SPEED|       |LOCATION|\n")
  89.     for line in pplx:
  90.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  91.         Wind_Speed = int(Wind_Speed)
  92.         Temperature = float(Temperature)
  93.         if Day == "Monday":
  94.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  95.             print("============================================================")
  96.     for line in pplx:
  97.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  98.         Wind_Speed = int(Wind_Speed)
  99.  
  100.         Temperature = float(Temperature)
  101.         if Day == "Tuesday":
  102.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  103.             print("============================================================")
  104.     for line in pplx:
  105.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  106.         Wind_Speed = int(Wind_Speed)
  107.         Temperature = float(Temperature)
  108.         if Day == "Wednesday":
  109.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  110.             print("============================================================")
  111.     for line in pplx:
  112.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  113.         Wind_Speed = int(Wind_Speed)
  114.         Temperature = float(Temperature)
  115.         if Day == "Thursday":
  116.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  117.             print("============================================================")
  118.     for line in pplx:
  119.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  120.         Wind_Speed = int(Wind_Speed)
  121.         Temperature = float(Temperature)
  122.         if Day == "Friday":
  123.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  124.             print("============================================================")
  125.     for line in pplx:
  126.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  127.         Wind_Speed = int(Wind_Speed)
  128.         Temperature = float(Temperature)
  129.         if Day == "Saturday":
  130.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  131.             print("============================================================")
  132.     for line in pplx:
  133.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  134.         Wind_Speed = int(Wind_Speed)
  135.         Temperature = float(Temperature)
  136.         if Day == "Sunday":
  137.             print(Day.ljust(10), time.ljust(10), str(Temperature).ljust(15), str(Wind_Speed).ljust(15), str(Location).ljust(10))
  138.             print("============================================================")
  139.  
  140.  
  141.  
  142.  
  143.  
  144.    
  145. def option_2():
  146.    
  147.     print("|DAY|\t  |TIME|   |LOCATION|\n")
  148.     for line in pplx:
  149.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  150.         Wind_Speed = int(Wind_Speed)
  151.         Temperature = float(Temperature)
  152.         if Day == "Monday":
  153.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  154.             print("============================")
  155.     for line in pplx:
  156.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  157.         Wind_Speed = int(Wind_Speed)
  158.         Temperature = float(Temperature)
  159.         if Day == "Tuesday":
  160.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  161.             print("============================")
  162.     for line in pplx:
  163.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  164.         Wind_Speed = int(Wind_Speed)
  165.         Temperature = float(Temperature)
  166.         if Day == "Wednesday":
  167.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  168.             print("============================")
  169.     for line in pplx:
  170.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  171.         Wind_Speed = int(Wind_Speed)
  172.         Temperature = float(Temperature)
  173.         if Day == "Thursday":
  174.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  175.             print("============================")
  176.     for line in pplx:
  177.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  178.         Wind_Speed = int(Wind_Speed)
  179.         Temperature = float(Temperature)
  180.         if Day == "Friday":
  181.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  182.             print("============================")
  183.     for line in pplx:
  184.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  185.         Wind_Speed = int(Wind_Speed)
  186.         Temperature = float(Temperature)
  187.         if Day == "Saturday":
  188.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  189.             print("============================")
  190.     for line in pplx:
  191.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  192.         Wind_Speed = int(Wind_Speed)
  193.         Temperature = float(Temperature)
  194.         if Day == "Sunday":
  195.             print(Day.ljust(10), time.ljust(10), str(Location).ljust(10))
  196.             print("============================")
  197.  
  198.  
  199. def option_3():
  200.  
  201.     daysofweek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
  202.     days = str(input("Please Enter A Certain Day Of Data To Display. "))
  203.  
  204.     if days not in daysofweek:
  205.         print("That is not a valid day.\n")
  206.         option_3()
  207.         daysofweek = "Unspecified"
  208.  
  209.     elif days == "Monday":
  210.             days_1()
  211.     elif days == "Tuesday":
  212.             days_1()
  213.     elif days == "Wednesday":
  214.             days_3()
  215.     elif days == "Thursday":
  216.             days_4()
  217.     elif days == "Friday":
  218.             days_5()
  219.     elif days == "Saturday":
  220.             days_6()
  221.     elif days == "Sunday":
  222.             days_7()
  223.     else:
  224.         print(days)
  225.    
  226.  
  227. def option_4():
  228.  
  229.     print("|TIME|\t  |LOCATION|\n")
  230.     for line in pplx:
  231.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  232.         Wind_Speed = int(Wind_Speed)
  233.         Temperature = float(Temperature)
  234.         if Day == "Monday":
  235.             print(time.ljust(10), str(Location).ljust(10))
  236.             print("=================")
  237.     for line in pplx:
  238.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  239.         Wind_Speed = int(Wind_Speed)
  240.         Temperature = float(Temperature)
  241.         if Day == "Tuesday":
  242.             print(time.ljust(10), str(Location).ljust(10))
  243.             print("=================")
  244.     for line in pplx:
  245.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  246.         Wind_Speed = int(Wind_Speed)
  247.         Temperature = float(Temperature)
  248.         if Day == "Wednesday":
  249.             print(time.ljust(10), str(Location).ljust(10))
  250.             print("=================")
  251.     for line in pplx:
  252.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  253.         Wind_Speed = int(Wind_Speed)
  254.         Temperature = float(Temperature)
  255.         if Day == "Thursday":
  256.             print(time.ljust(10), str(Location).ljust(10))
  257.             print("=================")
  258.     for line in pplx:
  259.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  260.         Wind_Speed = int(Wind_Speed)
  261.         Temperature = float(Temperature)
  262.         if Day == "Friday":
  263.             print(time.ljust(10), str(Location).ljust(10))
  264.             print("=================")
  265.     for line in pplx:
  266.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  267.         Wind_Speed = int(Wind_Speed)
  268.         Temperature = float(Temperature)
  269.         if Day == "Saturday":
  270.             print(time.ljust(10), str(Location).ljust(10))
  271.             print("=================")
  272.     for line in pplx:
  273.         Drone, Day, time, Temperature, Wind_Speed, Location = line.split(",")
  274.         Wind_Speed = int(Wind_Speed)
  275.         Temperature = float(Temperature)
  276.         if Day == "Sunday":
  277.             print(time.ljust(10), str(Location).ljust(10))
  278.             print("=================")
  279.  
  280.  
  281. def main_menu():
  282.     option = str(input("""Welcome To The Main Menu Of The Weather Program, \nPlease Select An Option Using The Numbers Listed Below!
  283. \n\t\t<---->\t☯ Options ☯\t<---->
  284.  
  285.  
  286.  
  287.         \n➊ Enter (`1`) To Display All Data
  288.         \n➋ Enter (`2`) To Display Weather Results Including Location/Day/Time
  289.         \n➌ Enter (`3`) To Display Weather Results By Selecting A Day
  290.         \n➍ Enter (`4`) To Display Weather Results Including Time/Location
  291.         \n➎ Enter (`5`) To Display Weekly Weather Highlights
  292.         \n➏ Enter (`6`) To Quit The Program\n"""))
  293.  
  294.     if option == "1":
  295.             option_1()
  296.     elif option == "2":
  297.             option_2()
  298.     elif option == "3":
  299.             option_3()
  300.     elif option == "4":
  301.             option_4()
  302.     elif option == "5":
  303.             option_5()
  304.     elif option == "6":
  305.             exit()
  306.     else:
  307.         print("Invalid Answer, Sending You Back To The Main Menu!")
  308.         time.sleep(2)
  309.         main_menu()
  310.  
  311. main_menu()
  312.  
  313. #Next i need to make Option 5 better. let them select a range of times
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top