Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON CODING QUESTION... Make a function that as defined below: def busell ( funds , stocks , qty , price , buy=False , sell=False ):
PYTHON CODING QUESTION... Make a function that as defined below:
def busell(funds, stocks, qty, price, buy=False, sell=False): """Function for stock transactions. Aruguments: funds: FLOAT, account balance, or money you have, currently. stocks: INT, number of stock you own. qty: INT, how much stock to buy or sell. price: FLOAT, price of 1 stock. buy: Option parameter, if set to true, will initiate a buy. sell: Option paramater, if set to true, will initiate a sell. Returns: Two values *must* be returned. The first (a float) is the new account balance (funds) as the transaction is completed. The second is the number of stock now owned (an int) after the transaction is complete. Error condition #1: If the `buy` and `sell` keyword parameters are both set to true, or both false. You *must* print an error message, and then return the `funds` and `stocks` parameters unaltered. This is an ambiguous transaction request! Error condition #2: If you buy, or sell without enough funds or stocks to sell, respectively. You *must* print an error message, and then return the `funds` and `stocks` parameters unaltered. This is an ambiguous transaction request! """
It should look like this:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started