Jed1

python craig

Sep 23rd, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. class bedroom:
  4. #this class enables us to automate the duties
  5. # in the bedroom
  6.  
  7.  
  8. # 1. Accept input from user and store in list ,
  9. # which might be converted to tuple
  10. list = []
  11.  
  12. temper1=int(input("please enter the temp"))
  13.  
  14. list.append(temper1)
  15. print (list )
  16.  
  17.  
  18. pure1=int(input("please enter the purity"))
  19.  
  20. list.append(pure1)
  21. print (list)
  22.  
  23.  
  24. # accept variable values as input
  25.  
  26. bedwash1=int(input("please enter the state of bedwashroom"))
  27.  
  28. list.append(bedwash1)
  29. print (list)
  30.  
  31.  
  32.  
  33. # 2. Now to initialize create methods and functions
  34.  
  35.  
  36. # A. First determine the locations of the various elements in a list
  37.  
  38. print (list[0])
  39. print (list[1])
  40. print (list[2])
  41. print (list[:])
  42.  
  43.  
  44.  
  45. print (list)
  46. def tempcheck(self,newList):
  47. temp=newList[0]
  48. if temp==27:
  49. print ("Bedroom has ideal temperature ")
  50. elif temp>=28 or temp<=26:
  51. print ("Bedroom Temperature is not ideal ,either too low or too cold. ")
  52. print ("Please to adjust the temperature to the optimum temperature which is 27 degree Celsuis")
  53.  
  54.  
  55. # now to initialize args
  56. def __init__(self,temp,puri1,bedwashroom,newList):
  57. self.temp=temp
  58. self.puri1=puri1
  59. self.bedwashroom=bedwashroom
  60.  
  61. tempcheck(newList)
  62.  
  63.  
  64.  
  65.  
  66. # now calling the functions
  67.  
  68. newvalue=tempcheck(list)
  69.  
  70. # B.
Advertisement
Add Comment
Please, Sign In to add comment