a = []
for i in range(3):
a.append(input())
j = 0
for i in a:
if i % 10 != 7:
j = min(a)
print j
I need an algorithm that finds the smallest positive number in a list whose decimal representation does not end with number 7. It is guaranteed that the list has at least one positive element whose decimal representation does not end with number 7. I tried this, but the condition does not work. For example: it says that 7 is the smallest in [9,8,7].
source
share