+ 3

Python bank account balance I need help

Here’s my code balance = int(input()); withdraw = int(input()); balance-=withdraw print("your balance" , balance)

2nd Feb 2023, 12:01 PM
Keith Woods
47 Antworten
+ 3
It has to be: balance=int (input ()) withdraw=int (input ()) balance-=withdraw print ("your balance",balance) Without the ";"
3rd Feb 2023, 3:05 PM
Abderahmane Ibarissen
Abderahmane Ibarissen - avatar
+ 5
It looks like your y in 'your balance' should be upper case.
2nd Feb 2023, 1:30 PM
Stefanoo
Stefanoo - avatar
+ 3
Look closer at expected output. Format is asking to Capitalize y and add colon at text end ':' so required statement is : print( "Your balance:", balance)
2nd Feb 2023, 1:35 PM
Jayakrishna 🇮🇳
+ 2
It’s introduction to python course Interacting with users Bank account balance challenge
2nd Feb 2023, 12:52 PM
Keith Woods
+ 2
That's python not C++ remove the columns ";"
3rd Feb 2023, 1:27 PM
Abderahmane Ibarissen
Abderahmane Ibarissen - avatar
+ 1
Introduction to python, interacting with users and bank account challange Here’s my code balance = int(input()); withdraw = int (input()); balance-=withdraw print("your balance" , balance)
2nd Feb 2023, 12:45 PM
Keith Woods
+ 1
"Introduction to Python" is only available to new accounts.
2nd Feb 2023, 12:52 PM
Lisa
Lisa - avatar
+ 1
Please provide the complete task description so we can check on it.
2nd Feb 2023, 12:54 PM
Lisa
Lisa - avatar
+ 1
Please provide the task description, not the number of XP
2nd Feb 2023, 1:16 PM
Lisa
Lisa - avatar
+ 1
Thanks
2nd Feb 2023, 1:41 PM
Keith Woods
+ 1
hellobud I don't really see what the problem is with your code it's fine unless you did not follow the instructions. It would be nice if you showed the question
3rd Feb 2023, 10:52 AM
Alex Wairegi
Alex Wairegi - avatar
+ 1
Also loss those semicolons
3rd Feb 2023, 10:53 AM
Alex Wairegi
Alex Wairegi - avatar
+ 1
class BankingSystem: def __init__(self, balance = 0): self.balance = balance def withdrawFunds(self, withdrawfunds): balance = balance - withdrawfunds def depositFunds(self, depositfunds): balance = depositfunds + self.balance; def displayfunds(self): print(self.balance); def displayFunds(self): print(f"Your account balance is:", self.balance); def DisplayFunds(self): print("Your account balance is: %d" % self.balance) def deposit(self): pass withdraw = int(input()) progObj = BankingSystem(300) progObj.depositFunds(1000) progObj.depositFunds(1000) #progObj.withdrawFunds(withdraw) progObj.displayfunds() progObj.displayFunds() progObj.DisplayFunds() Different ways to accomplish this
3rd Feb 2023, 11:10 PM
Andre Richmond
Andre Richmond - avatar
+ 1
I know.. it is a c++ /java habit lol it doesnt affect the program at all though
4th Feb 2023, 6:31 AM
Andre Richmond
Andre Richmond - avatar
+ 1
Here The Code def calculate_balance(balance, annual_interest_rate, monthly_payment): for i in range(12): balance = balance - monthly_payment balance = balance + (balance * (annual_interest_rate / 12.0)) return balance balance = 42 annual_interest_rate = 0.2 monthly_payment = 50 print("Remaining balance:", calculate_balance(balance, annual_interest_rate, monthly_payment))
4th Feb 2023, 11:48 AM
DURGA PRASAD PILLI
DURGA PRASAD PILLI - avatar
0
What exactly the issue that you are running into? (Also, no need for semicolons).
2nd Feb 2023, 12:04 PM
Justice
Justice - avatar
0
It says my answer is incorrect
2nd Feb 2023, 12:04 PM
Keith Woods
0
Please don't post duplicate questions: https://www.sololearn.com/Discuss/3188724/?ref=app Also, you may want to use some kind of concatenation or a formatted string.
2nd Feb 2023, 12:06 PM
Justice
Justice - avatar
0
So is my code incorrect
2nd Feb 2023, 12:07 PM
Keith Woods
0
You just stated that something told you it was.
2nd Feb 2023, 12:08 PM
Justice
Justice - avatar