Sometimes, it is better to clear understand the requirements and the original source code logic, in order to gain insight.
Sometimes, it is better to understand the requirements and the original source code logic, to perform a good conversion into the target language.
Sometimes, it is better to understand the requirements and the original source code logic, in order to throw that junk away and restart from scratch your program, using the target language.
def find_multiples_of_3_in_range( first, last ):
if last < first:
return 0
frem = first % 3
lrem = last % 3
if frem != 0:
first += (3 - frem)
last -= lrem
return (last -first)//3 + 1
def main():
first = int(input("insert the starting number of the range "))
last = int(input("insert the last number of the range "))
multiples = find_multiples_of_3_in_range(first, last)
print("thre are {} multiples of 3 in the given range".format(multiples))
main()