Python Forum
<= not supported but I already use int as an input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
<= not supported but I already use int as an input
#1
Here's my code.
userlist = "Angelo","Luigi","Russell"
userlist2 = "Von", "Enzo", "R-Cel"

#date_exp = '4-8-2032'

#date = datetime.strptime(date_exp)

class SharedBankAccount:
    
    
    def __init__ (self,userlist,userlist2):
        #self.acctage = age
        self.listofusers = userlist
        self.listofusers2 = userlist2
        self.bankBalance = 0.0
      
        
    def AccountNo (self):
        
        #import random

        #account_number = random.randint(5,10)

        #for i in range(12):
            #account_number = random.randint(1,10)
            print ("The 1st account number is : 009223" )
            print ("The 2nd account number is : 009224")
            
            
    def listofUsers (self):
        print ("1st list of users : {}" .format(self.listofusers))
        print ("2nd of list of users : {}" .format(self.listofusers2))
        
    def Balance (self,balance):
        self.bankBalance = "0" + str(balance)
        print ("The Available balance is ",balance)
        
        
    def DateCreated (self):
        import datetime
        today = datetime.datetime.now()
        print("The Bank Account was created in :",today)
        
    def Withdraw (self):
        amount_withdraw = int(input("Amount to Withdraw : "))
        
        if self.bankBalance <= amount_withdraw:
            self.bankBalance -= amount_withdraw
            print("The amount you withdraw : ",amount_withdraw)
        else:
            print("Error! Insufficient balance")
        
        
    def Deposit(self):
        amount_deposit = int(input("Amount to Deposit : "))
        print(amount_deposit)
            
    #def AccountAge (self,AcctAge):
        #self.acct_age = AcctAge
        
    
    
    
    def AccExp (self):
        from datetime import datetime
        date_exp = '2032-04-08'

        date = datetime.strptime
        print("The account will expire on : ",date_exp)
        #print('Type: ',type(date_exp))
        
    def ShowUsers(self):
        return self
        print("The bank users are {}".format(self.listofusers))
        
    def ShowUsers2(self):
        return self
        print ("The Second bank users are {}" .format(self.listofusers2))
        
    def PrintBankDetails (self):
        print("Details : " .format(self.acc_no))
        
        
        
bankaccount = SharedBankAccount(userlist, userlist2)
#bankaccount2 = SharedBankAccount(userlist, userlist2)
bankaccount.AccountNo()
bankaccount.listofUsers()
bankaccount.Balance(0)
bankaccount.DateCreated()
bankaccount.AccExp()
bankaccount.Withdraw()
bankaccount.Deposit()
Yoriz write Apr-07-2022, 02:48 PM:
Post reverted back as the OP removed everything
Yoriz write Apr-07-2022, 02:36 PM:
Please post all code, output and errors (In their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
#2
This could be the issue ( i have not run your code)
    def Balance (self,balance):
        self.bankBalance = "0" + str(balance)
        print ("The Available balance is ",balance)
is assigning self.bankBalance as a string not a number
vonits23 likes this post
#3
thank you sir it works :)


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020