from random import randint inp = randint(1, 100) total = 0 for i, num in enumerate(range(inp, start = 1)) : total += i else : print(total)