- I made a loop that counts how many 0s are at the end of the string
for i in range(len(num) - 1, -1, -1):
if num[i] == '0':
count += 1
else:
break- I make a loop that goes until the length of the string - 0
for i in range(len(num) - count):
ans += num[i]