Bank Account App Problem

Welcome to the Get Help category!

Working on a banking app. Here is my code below.
The error message reads:
Traceback (most recent call last):
File “c:\Users\Andrew\Desktop\Codecademy\Python\Python_Projects\bank_account_project\”, line 90, in
User(“Strikeouts, ‘27’, ‘2790’”)
TypeError: User.init() missing 2 required positional arguments: ‘pin’ and ‘password’

Can someone tell me what is going on and where I went wrong?

# class zone

class BankAccount(object):
  balance = 0
  def __init__(self, name): = name
  def __repr__(self): 
    return f"Welcome {} Your current balance is: {self.balance}"
  def show_balance(self):
    print(f"Total balance is {self.balance:.2f}")
  def deposit(self, amount):
    if amount <= 0:
      print("Error: Deposit must be a number greater than 0!") 
      print(f"Depositing {amount}")
      self.balance += amount
  def withdraw(self, amount):
      if amount > self.balance:
        print("Insufficent funds! Please input a withdraw amount less than your current balance!")  
        print(f"Withdrawing {amount}") 
        self.balance -= amount

class User:  
    def __init__(self, name, pin, password):  = name = pin  
        self.password = password  
    def change_name(self, new_name): = new_name
        return new_name

    def change_pin(self, new_pin): = new_pin
        return new_pin

    def change_password(self, new_password):
        self.password = new_password
        return new_password

class BankUser(User):
    def __init__(self, name, pin): = name = pin
      # super().__init__(name, pin, password)
      # self.balance = 0

    def show_balance(self):  
        print( + " has an account balance of: " + str(self.balance))

    def withdraw(self, amount):  
        self.balance -= amount

    def deposit(self, depositamount):
        self.balance += depositamount

    def transfer_money(self, user, amount):
        user_input = input("Please insert your pin for the transfer ")
        if == user_input:
            bill_gates.balance += amount
            steve_jobs.balance -= amount
            return True
            print("Invalid passcode.")
            return False
        return True  

my_account = BankAccount("Andrew Stribling")

# Running the App Zone
User("Strikeouts, '27', '2790'")

# Github will be used to update the string formatting method. 

# on task 11 we use the self. keyword to tell python to access the class. if we don't use the self keyword, it will not know where to pull information from. it is similar to the this keyword in javascript. This goes for running methods in objects, and using variables inside of the objects. you need to use the self keyword when the error statement says this is not defined in most cases. 

# when working with objects, and its not interpreting my variables. I may need to use the self.variable name for it to recognize it due to scoping issues.
# %s is used as a placeholder the % is used as an ender of the string formatting and the variables need to be placed immediately afterwards in the order of necessary apperance. 
        # on this line we are taking the characteristics of the parent.
        # we tell the computer to go get the parents informaiton on this line.```

The error message has given an accurate description of what has gone wrong and where.

You have wrapped all the arguments in a single pair of quotes "..." which means everything in between the quotes is considered a string. You have passed one argument, instead of the three arguments (name, pin, password) expected by the __init__ of the User class

# You wrote:
User("Strikeouts, '27', '2790'")

# It should be:
User('Strikeouts', '27', '2790')
1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.