Question
can u properly indent this python program and share that intented code in answers section pls and run and also share screenshot when run. and
can u properly indent this python program and share that intented code in answers section pls and run and also share screenshot when run. and share indented code.
from random import randint from datetime import date import time import sys class Bank: newUser={} registeredUsers={} allTrans=[] loanTrans={} def viewNewRegisteredRequest(self): print(self.newUser) def selectUser(self,array): if len(array) == 0 : print("No new User Present") return '' print(array) print() while(True): print("Enter the user name to approve the request") name=input() if name not in array.keys(): print("Please enter a correct user name") else: break return name def toApproveUserRequest(self): name = self.selectUser(self.newUser) if name !='': self.registeredUsers[name] = self.newUser[name] print("User got registered") del self.newUser[name] print("Registered User", self.registeredUsers) print("newUsers", self.newUser) def toProvideLoanDetailtoUser(self): name = self.selectUser(self.registeredUsers) self.registeredUsers[name]['UniqueLoanId']='ABCD-'+str(randint(0,100)*randint(0,149)) self.registeredUsers[name]['installemntDate']=date.today() self.registeredUsers[name]['installemntAmountMonth']=(int(self.registeredUsers[name]['installment'])/12) print(self.registeredUsers[name]) def toViewSpecificUserTrans(self): name = self.selectUser(self.registeredUsers) print( self.registeredUsers[name]['transactions']) def toViewSpecificloanTypeTrans(self): while(True): print("Enter the specific transaction type") typeLoan=input() if typeLoan not in self.loanTrans.keys(): print("Please enter a correct type") else: break print(self.loanTrans[typeLoan]) def toViewAllTrans(self): print(self.allTrans) def viewAllLoanTrans(self): print(self.loanTrans) def AdminMenu(self): print("Welcome to the Admin Menu. Please enter your choice") print("1. To view new Registered User request") print("2. To approve a user registration request") print("3. To provide loan details to a registered user") print("4. To view transaction of a specific customer") print("5. To view transaction of a specific type") print("6. To view transaction of all the customers") print("7. To view transaction of all loan types") print("8. Exit") chioce = int(input()) if chioce ==1: self.viewNewRegisteredRequest() elif chioce ==2: self.toApproveUserRequest() elif chioce ==3: self.toProvideLoanDetailtoUser() elif chioce ==4: self.toViewSpecificUserTrans() elif chioce ==5: self.toViewSpecificloanTypeTrans() elif chioce ==6: self. toViewAllTrans() elif chioce ==7: self.viewAllLoanTrans() elif chioce ==8: self.mainMenu() def loanDetails(self): print("Loan Details") print("Interest Rate 12% per annum ") def loanCalc(self): print("Enter amount of loan you want") amount= int(input()) print("No of years") years=int(input()) interest = 12 netAmount = amount*pow((1+(interest/100)),years) print("Net Loan Playable", netAmount) def registerUser(self): user={} print("Enter Name") user['name'] = input() print("Enter Address") user['address'] = input() print("Enter Email") user['Email'] = input() print("Enter Contact No") user['contact'] = input() print("Enter Gender") user['gender'] = input() print("Enter DOB") user['DOB'] = input() print("Enter loan Type") user['loanType'] = input() print("Enter loan Terms") user['loanterms'] = input() print("Enter Installment") user['installment'] = input() print("Enter userid") user['userid'] = input() print("Enter password") user['password'] = input() print("Enter Rewrite Password") user['rewritePass'] = input() user['Amountleft'] = user['installment'] user['transactions']=[] self.newUser[user['userid']] = user def newCustomerMenu(self): print("Welcome to the New Customer Menu. Please enter your choice") print("1.To check loan details") print("2. to use loan calculator") print("3. To do registration") print("4. Exit") chioce = int(input()) if chioce ==1: self.loanDetails() elif chioce ==2: self.loanCalc() elif chioce ==3: self.registerUser() elif chioce ==4: self.mainMenu() def loginRegisteredUser(self): print("enter User Name") userid= input() while True: if userid not in self.registeredUsers.keys(): print("Username not found. Please enter username again ") userid = input() else: break print("Enter password") password=input() while True: if password != self.registeredUsers[userid]['password']: print("wrong password. Please enter again") password = input() else: break print("Account accessed") return userid def checkLoanDetails(self,userid): print("Loan details") print("Loan ID", self.registeredUsers[userid]['UniqueLoanId']) print("Loan Installemnt Date", self.registeredUsers[userid]['installemntDate']) print("Loan Installment amount per Month", self.registeredUsers[userid]['installemntAmountMonth']) print("Loan Type", self.registeredUsers[userid]['loanType']) print("Loan Terms", self.registeredUsers[userid]['loanTerms']) print("Loan Total Amount", self.registeredUsers[userid]['installment']) def payLoanInstallment(self,userid): print("Paying Installemnt") self.registeredUsers[userid]['transactions'].append({'Amount':self.registeredUsers[userid]['installemntAmountMonth'],'DateTime':time.ctime(time.time())}) self.registeredUsers[userid]['Amountleft']-=self.registeredUsers[userid]['installemntAmountMonth'] self.allTrans.append({'UserId':userid,'LoanType':self.registeredUsers[userid]['loanType'] ,'Amount':self.registeredUsers[userid]['installemntAmountMonth'],'DateTime':time.ctime(time.time())}) if self.registeredUsers[userid]['loanType'] not in self.loanTrans: self.loanTrans[self.registeredUsers[userid]['loanType']]=[] self.loanTrans[self.registeredUsers[userid]['loanType']].append({'UserId':userid,'LoanType':self.registeredUsers[userid]['loanType'] ,'Amount':self.registeredUsers[userid]['installemntAmountMonth'],'DateTime':time.ctime(time.time())}) else: self.loanTrans[self.registeredUsers[userid]['loanType']].append({'UserId':userid,'LoanType':self.registeredUsers[userid]['loanType'] ,'Amount':self.registeredUsers[userid]['installemntAmountMonth'],'DateTime':time.ctime(time.time())}) def viewOwntransactions(self,userid): print("All the transactions") print(self.registeredUsers[userid]['transactions']) def checkLoanStatus(self,userid): print("Loan Status") if self.registeredUsers[userid]["Amounleft"] == 0: print("Loan Amount Paid") else: print("Laon status Active") def registeredUsersMenu(self,userid): userid ='' print("Welcome to the Registered User Menu. Please enter your choice") print("1. Login") print("2. To check loan details") print("3. To pay loan installment") print("4. To view their own transactions") print("5. To check status of loan") print("6. Exit") chioce = int(input()) if chioce ==1: userid = self.loginRegisteredUser() elif chioce ==2: self.checkLoanDetails(userid) elif chioce ==3: self.payLoanInstallment(userid) elif chioce ==4: self.viewOwntransactions(userid) elif chioce ==5: self.checkLoanStatus(userid) elif chioce ==6: self.mainMenu() def Admin(self): self.AdminMenu() def newCustomer(self): self.newCustomerMenu() def registerCustomer(self): self.registeredUsersMenu() def mainMenu(self): while True: print("Welcome to Malaysia Banking System. Ente user Type") print("1. Admin") print("2. New Customer") print("3. Registered Customer") print("4.Exit") choice=int(input()) if choice ==1: self.Admin() elif choice ==2: self.newCustomer() elif choice == 3: self.registerCustomer() else: print("exiting") sys.exit() malaysiaBank=Bank() malaysiaBank.mainMenu()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started