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