Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. ##############
  2. # Josh Orchard
  3. # Task 2
  4. ##############
  5.  
  6. ###########
  7. # import(s)
  8. ###########
  9.  
  10. ###########
  11. # Lines
  12. # 0 = frozen Provides convience for me when coding to see which line a solution is on
  13. # 0 = crashed
  14. # 1 = screen
  15. # 1 = broken
  16. # 2 = charge
  17. # 3 = cracked
  18. # 4 = hot
  19. # 4 = overheating
  20.  
  21. import time
  22.  
  23. term = "frozen" #term we want to search for
  24. problem = input("Please write a sentance explaining your problem\n>") #read input from user
  25. words = problem.split() #split the sentence into individual words
  26. if term in words: #see if one of the words in the sentence is the word we want
  27. frozensolution = open("Task 2.txt", "r").readlines()[0]
  28. print (frozensolution)
  29. time.sleep(5)
  30. quit()
  31.  
  32.  
  33. term = "crashed"
  34. if term in words:
  35. frozensolution2 = open("Task 2.txt", "r").readlines()[0]
  36. print (frozensolution2)
  37. time.sleep(5)
  38. quit()
  39.  
  40. term = "screen"
  41. words = problem.split()
  42. if term in words:
  43. screen_offsolution = open("Task 2.txt", "r").readlines()[1]
  44. print (screen_offsolution)
  45. time.sleep(5)
  46. quit()
  47.  
  48. term = "broken"
  49. words = problem.split()
  50. if term in words:
  51. screen_offsolution2 = open("Task 2.txt", "r").readlines()[1]
  52. print (screen_offsolution2)
  53. time.sleep(5)
  54. quit()
  55.  
  56. term = "charge"
  57. words = problem.split()
  58. if term in words:
  59. chargesolution = open("Task 2.txt", "r").readlines()[2]
  60. print (chargesolution)
  61. time.sleep(5)
  62. quit()
  63.  
  64. term = "cracked"
  65. words = problem.split()
  66. if term in words:
  67. crackedsolution = open("Task 2.txt", "r").readlines()[3]
  68. print (crackedsolution)
  69. time.sleep(5)
  70. quit()
  71.  
  72. term = "hot"
  73. words = problem.split()
  74. if term in words:
  75. hotsolution = open("Task 2.txt", "r").readlines()[4]
  76. print (hotsolution)
  77. time.sleep(5)
  78. quit()
  79.  
  80. term = "overheating"
  81. words = problem.split()
  82. if term in words:
  83. hotsolution2 = open("Task 2.txt", "r").readlines()[4]
  84. print (hotsolution2)
  85. time.sleep(5)
  86. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement