You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for d in range(ord(l[pos])-47, 10): # check if there is any digit larger than l[pos]
for k in range(pos, len(l)):
if ord(l[k]) == d+48 or (l[k] == '2' and d == 5) or (l[k] == '6' and d == 9) or (l[k] == '5' and d == 2) or (l[k] == '9' and d == 6): # found a digit higher than l[pos]
found = True; l[k] = l[pos]; l[pos] = str(d); break
if found: break
if found: break
pos -= 1
if not found: print('The price cannot be raised')
else:
l[pos+1:] = sorted(map(lambda x: '2' if x == '5' else '6' if x == '9' else x, l[pos+1:]))