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
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)
Comments
Leave a comment