Obtenez la somme d'une plage de l'entrée utilisateur

# From user input, using lambda
# pass string directly to lambda
print((lambda s: sum(range(int(s[0]), int(s[1])+1)))(input().split()))
# or, convert string to list then pass into lambda
print((lambda s: sum(range(s[0], s[1]+1)))(list(map(int, input().split()))))
# input: 1 100
# output: 5050
# Or, simply, from variables
a, b = 1, 100
print(sum(range(a, b+1)))
Minion OuO