Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calculate the Balance - Deposit If the action is Deposit 'D, use a deposit function to add funds to the account Write a function called

Calculate the Balance - Deposit

If the action is Deposit 'D, use a deposit function to add funds to the account

  1. Write a function called `deposit`.
  2. Request from the user the amount to be deposited. This value should be stored in a variable called `deposit_amount`. Use both the `input` and `float` methods in order to ensure the `deposit_amount` is a float value.
  3. Calculate a new account balance.
  4. The calculation for depositing funds into the account is `account_balance = account_balance + deposit_amount`.
  5. Print the new account balance.

    Deposit Input

    userchoice = input ("What would you like to do? ") userchoice = 'B' deposit_amount = 200 

    Deposit Output

    What would you like to do? How much would you like to deposit today? Deposit was $200, current balance is $700.25

image text in transcribed

What I have so far. I can't get the deposit function down right

import sys #account balance account_balance float (500.25) functions go here ) print ("What would you like to do?") account_balance float (500.25) def show_balance) print("Your current balance: ") print (account_balance) rn account_balance show_balance ()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions