Answer to Question #346002 in Python for SAIKUMAR

Question #346002

krishna owns N mobile phones (numbered 1 through N) He wishes to sell all of them in the coming next N years by selling exactly one mobile per year.

N = 3 

mobile prices = [60000, 60000, 60000]


depreciating 1000rs per every year after selling each mobile 


first year mobile price = 60000

second-year decreasing = 1000 depreciation 



in this way he sold the mobiles could you please resolve my query



1
Expert's answer
2022-05-30T08:16:29-0400
print("Enter the number of phones Krisha owns: ")
n = int(input() )
print("Enter mobile prices [separated by spaces]: ")
prices = [ int(x) for x in input().split() ]
earned = 0


while(len(prices)>0):
    earned+=max(prices) # finding the best deal
    prices.remove( max(prices) )
    for i in range(len(prices)):
        prices[i]-=1000
        if(prices[i]<1000): # min price is 1000
            prices[i]=1000
print(earned)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS