Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey there, so I tried to apply this code to my homework assignment multiple times, and the code passed 4 test and failed 3 tests.

Hey there, so I tried to apply this code to my homework assignment multiple times, and the code passed 4 test and failed 3 tests. I need this code to pass 5 tests, and I am stuck in finding the problem to my code here.

def correct_decision(current_shares,purchase_price,market_price,available_funds):

if market_price>purchase_price:

profit = current_shares*(market_price-purchase_price)

if profit>10:

print('Sell {} shares'.format(current_shares))

else:

print('Hold Shares')

if purchase_price>market_price:

remaining_funds = available_funds-10

if remaining_funds<=0:

print('Hold Shares')

else:

shares_can_be_bought = remaining_funds//market_price

print('Buy {} shares'.format(shares_can_be_bought))

correct_decision(10,100,1,10)

correct_decision(20,2,1,21)

correct_decision(15,12,1,12)

correct_decision(1,1,11,0)

correct_decision(10,1,3,30)

correct_decision(1,1,12,0)

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago