Answer to Question #196978 in Python for reee

Question #196978

Please arrang the program below. I indicate the sample and output of the program


n = int(input())

for i in range(n):

 lst = list(map(int,input().split()))

 lst1 = lst[1:]

  

 elem = lst1[0]

 counter= 1


for j in range (1,len(lst1)):

 if 2*elem > lst1[j]:

  counter = 0

  break

 elem = lst1[j]


 if(counter == 1):

  print("Denominations: ",lst1)

  print("Good coin denominations !")

 else:

   print("Denominations: ",lst1)

   print("Bad coin denominations !")


Sample input:

2

4 1 5 10 25

3 1 5 6

Ouput:

Denominations: [1, 5, 6, 25]

Good coin denominations!


Denominations: [1,5,6]

Bad coin denominations!



1
Expert's answer
2021-05-23T14:37:05-0400


n = int(input("Enter: "))
for i in range(n):
 lst = list(map(int,input().split()))
 lst1 = lst[1:]
 elem = lst1[0]
 counter= 1


for j in range (1,len(lst1)):
 if 2*elem > lst1[j]:
  counter = 0
  break
 elem = lst1[j]


if(counter == 1):
  print("Denominations: ",lst1)
  print("Good coin denominations !")
else:
   print("Denominations: ",lst1)
   print("Bad coin denominations !")





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