Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

PYTHON 3

USING PYTHON 3

I need help incorporating this feedback into my code. The script I have written DOES work, but it is not what my teacher is asking. I am unable to go back and reread the book due to once completing it you are no longer able to view those chapters. Thanks!

FROM INSTRUCTOR:

“Input (Parameters) Function(s): Your functions did not utilize input parameters. For example, the deposit() function should be deposit(amount) and when you call it, you pass in the amount you want to deposit. Also, you should separate your print statements from the functions. Functions should do one thing and one thing only (return account balance for example) and then the calling code handles output to the user.

Script Comments: Your comments should explain what the code is doing. A number of your comments do not help understand what the code is doing, they merely point out that there is a function.  

#add another custom function here

#another example of a function…

Input (Parameters) Function(s): Your functions did not utilize input parameters. For example, the deposit() function should be deposit(amount) and when you call it, you pass in the amount you want to deposit. Also, you should separate your print statements from the functions. Functions should do one thing and one thing only (return account balance for example) and then the calling code handles output to the user.”

MY CODE IS:

import sys

#account balance

account_balance = float(500.25)

#After defining our initial account balance, we start here with a custom function.

def balance():

#The following line is an example of a function which returns the current balance output.

 print(‘Your current balance: n %.2f’% float(account_balance))

#add another custom function here:

def deposit():

 deposit_amount = float(input(‘How much would you like to deposit today?n’))

 balance = account_balance + deposit_amount

#Another example of a function used to return the correct output, here the account balance and the deposit amount were added together for the total sum.

 print(‘Deposit was $%.2f, current balance is $%.2f’ % (deposit_amount, balance))

#We finish with a final custom function and branching in the following block of code.

def withdraw():

#The following code is an input parameter within a function. 

withdraw_amount = float(input(‘How much would you like to withdraw today?n’))

 if withdraw_amount >= account_balance:

   print(‘$%.2f is greater than your account balance of $%.2f’ % (withdraw_amount, account_balance))

 else:

   balance = account_balance – withdraw_amount

   print(‘Withdrawal amount was $%.2f, current balance is $%.2f’ % (withdraw_amount, balance))

#Finally we gather the user input using if, else, and elif conditional statements which then call the functions entered previously based on what the user inputs.

userchoice = input (“What would you like to do?n”)

if (userchoice == ‘D’):

   deposit ()

elif (userchoice == ‘W’):

   withdraw()

elif (userchoice == ‘B’):

   balance()

print(‘Thank you for banking with us.’)

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"