#๐Ÿ”’ Help

50 messages ยท Page 1 of 1 (latest)

cyan wasp
#

Help me with the class function.

covert baneBOT
#

@cyan wasp

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cyan wasp
#
class BankAccount:
  def __init__(self, account_number, balance, owner):
    self.account_number = account_number
    self.balance = balance
    self.owner = owner

  def deposit(self, amount):
    balance += amount
    print(f"{amount} has been deposited into the account. The balance now is {balance}.")

  def withdraw(self, amount):
    balance -= amount
    print(f"{amount} has been withdrawn from the account. The balance is now {balance}.")

  def display_balance(self):
    print(f"{balance}")

bankaccount1 = BankAccount(10002239929, 30,000,000, 'RedVersa')

bankaccount1.deposit(int(input("How much woud you like to deposit? ")))

bankaccount1.withdraw(int(input("How much would you like to withdraw? ")))

bankaccount1.display_balance()
ornate ocean
#

in your deposit and withdraw

cyan wasp
#

ok

ornate ocean
#

and the display balance

cyan wasp
#

wait

#

are thos the main problems

ornate ocean
#

those are the obvious problems that I can see

cyan wasp
#

ok

ornate ocean
#

you havn't mentioned what the actual problem is yet

cyan wasp
#

it says I mentioned 4 parameters but It sees 6

ornate ocean
#

ah I missed that

cyan wasp
#

Traceback (most recent call last):
File "C:\Users\007\Documents\C++ and Py\Py\practice.py", line 18, in <module>
bankaccount1 = BankAccount(10002239929, 30,000,000, 'RedVersa')
TypeError: BankAccount.init() takes 4 positional arguments but 6 were given

#

this error

ornate ocean
#

So if you wanna use 30 mil

#

dont use commas

quartz pewter
#

write 30,000,000 as 30_000_000

ornate ocean
cyan wasp
#

ok

#

oh

quartz pewter
#

or just 30000000 but that's a bit hard to read

cyan wasp
#

true

#

Imma run

cyan wasp
#

1 minute

ornate ocean
cyan wasp
#

till the teacher catches me

ornate ocean
cyan wasp
#

a business studies one

ornate ocean
#

Is this an exam?

cyan wasp
#

Im just practiciing code in school

ornate ocean
#

Bruh

#

Focus on your business studies

#

Code on your free time

compact dome
#

coding python in school ๐Ÿ˜Ž

cyan wasp
#

same

quartz pewter
#

yeah, code is useful for other studies but only really when you're already good at code

cyan wasp
#

is my free time

#

been caught

quartz pewter
#

fair enough

cyan wasp
#

thanks to al fro the help

#

!close

covert baneBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Help