Guest User

Untitled

a guest
Jan 19th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. #code for ATM
  2. userpin = ["1234", "2345", "3456", "4567"]
  3. userpass = ["1234", "2345", "3456", "4567"]
  4. username = ["Rishabh", "Siddharth", "Kashish", "Mahima"]
  5. userbalance = [20500, 43567, 45672, 67800]
  6.  
  7. class Bank:
  8.  
  9. def __init__(self, bal=0, index=0):
  10. #if __name__ == '__main__':
  11. self.bal = bal
  12. self.index = index
  13.  
  14. def start(self):
  15. if __name__ == '__main__':
  16. print("tt=== Welcome to ATM ===")
  17.  
  18. inputpin=input("Enter your pin :")
  19. inputpass= input("Enter your password :")
  20. b1.pinpasscheck(inputpin,inputpass)
  21.  
  22. def pinpasscheck(self,pin,passw):
  23. self.pin=pin
  24. self.passw=passw
  25. inputpin=pin
  26. inputpass=passw
  27. index=0
  28. flag= False
  29. for i in range(0,len(userpin)):
  30. if inputpin==userpin[i]:
  31. index=i
  32. print(index)
  33. if inputpass==userpass[index]:
  34. print("Login Succeeded !")
  35. flag= True
  36. b1.operationlist(index)
  37. if flag==False:
  38. print("Login invalid. Please check username or password")
  39. else:
  40. pass
  41. else:
  42. pass
  43.  
  44. def operationlist(self,indexval):
  45.  
  46. self.indexval=indexval
  47. index=indexval
  48. print("n Hello, ", username[index])
  49. print("""
  50. 1) Balance
  51. 2) Withdraw
  52. 3) Deposit
  53. 4) Change password
  54. 5) Quit
  55. """)
  56. useroption = int(input("Select an option:"))
  57.  
  58. if useroption == 1:
  59. print("nYour current balance is {}".format(userbalance[index]))
  60. b1.operationlist(index)
  61.  
  62. elif useroption == 2:
  63. amount= int(input("nEnter amount you want you want to withdraw : Rs"))
  64. b1.withdraw(amount,index)
  65.  
  66. else:
  67. print("None of the above options selected. Please select any one of the provided options.")
  68. b1.operationlist(index)
  69.  
  70. def withdraw(self, amt, index):
  71. self.amt= amt
  72. amount = amt
  73. self.index= index
  74. if amount > userbalance[index]:
  75. print("Oops! Insufficient funds.")
  76. b1.operationlist(index)
  77.  
  78. rembalance = userbalance[index] - amount
  79. userbalance.remove(userbalance[index])
  80. userbalance.insert(index, rembalance)
  81. print("Your remaining balance is: ", userbalance[index])
  82. b1.operationlist(index)
  83.  
  84. b1 = Bank()
  85. b1.start()
  86.  
  87. #code for VirtualDoctor
  88. import xlrd
  89. import pandas
  90. from NewATM import Bank
  91.  
  92. path = "symptoms.xlsx"
  93. book = xlrd.open_workbook(path)
  94. sheet= book.sheet_by_index(0)
  95. b2= Bank()
  96.  
  97. data= [[sheet.cell_value(r,c) for c in range (sheet.ncols)] for r in range (sheet.nrows)]
  98.  
  99. diseaselist= []
  100. for i in range (1,sheet.nrows):
  101. diseaselist.append(sheet.cell_value(i,0))
  102.  
  103. symptoms=[]
  104. for i in range (1, data.__len__()):
  105. tmp= data[i][1:5]
  106. symptoms.append(tmp)
  107.  
  108. print(symptoms)
  109. inputlist = []
  110. b2.start() #THIS DOES NOT WORKK !!!!!!!!!!!!!!!!!!!!! WHY ???
Add Comment
Please, Sign In to add comment