Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##############
- # Josh Orchard
- # Task 2
- ##############
- ###########
- # import(s)
- ###########
- ###########
- # Lines
- # 0 = frozen Provides convience for me when coding to see which line a solution is on
- # 0 = crashed
- # 1 = screen
- # 1 = broken
- # 2 = charge
- # 3 = cracked
- # 4 = hot
- # 4 = overheating
- import time
- term = "frozen" #term we want to search for
- problem = input("Please write a sentance explaining your problem\n>") #read input from user
- words = problem.split() #split the sentence into individual words
- if term in words: #see if one of the words in the sentence is the word we want
- frozensolution = open("Task 2.txt", "r").readlines()[0]
- print (frozensolution)
- time.sleep(5)
- quit()
- term = "crashed"
- if term in words:
- frozensolution2 = open("Task 2.txt", "r").readlines()[0]
- print (frozensolution2)
- time.sleep(5)
- quit()
- term = "screen"
- words = problem.split()
- if term in words:
- screen_offsolution = open("Task 2.txt", "r").readlines()[1]
- print (screen_offsolution)
- time.sleep(5)
- quit()
- term = "broken"
- words = problem.split()
- if term in words:
- screen_offsolution2 = open("Task 2.txt", "r").readlines()[1]
- print (screen_offsolution2)
- time.sleep(5)
- quit()
- term = "charge"
- words = problem.split()
- if term in words:
- chargesolution = open("Task 2.txt", "r").readlines()[2]
- print (chargesolution)
- time.sleep(5)
- quit()
- term = "cracked"
- words = problem.split()
- if term in words:
- crackedsolution = open("Task 2.txt", "r").readlines()[3]
- print (crackedsolution)
- time.sleep(5)
- quit()
- term = "hot"
- words = problem.split()
- if term in words:
- hotsolution = open("Task 2.txt", "r").readlines()[4]
- print (hotsolution)
- time.sleep(5)
- quit()
- term = "overheating"
- words = problem.split()
- if term in words:
- hotsolution2 = open("Task 2.txt", "r").readlines()[4]
- print (hotsolution2)
- time.sleep(5)
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement