-4
My doubt is about the bow while
, I can’t understand how it works.
Write a Python function that takes, by argument, two integers and returns the sum of all integers between the two (including the two).
my code...
def somatorio(x,y):
count = 0
soma = 0
while count < y:
soma = y + (y-count)
count += 1
return soma
print(somatorio(1,2))
print(somatorio(1,5))
What do you want to know specifically? You used something you don’t know what it’s for?
– Maniero
was about the condition, the doubt has already been resolved, thank you ^^
– Pedro Henrique
Just for the record, this code is wrong, because it doesn’t return "the sum of all the integers between the two", should look something like this: https://ideone.com/6b1iuW <-- this link also has other options how to do
– hkotsubo