0

List of integers (let 1-10). Write code to add the integers and display the sum.(using loop)

3rd Oct 2018, 2:00 PM
partha
partha - avatar
2 Respostas
+ 1
print(sum(range(1, 11)))
3rd Oct 2018, 2:09 PM
Kevin Dietrichstein
Kevin Dietrichstein - avatar
+ 1
a = range(1,10) res = 0 for num in a: res+=num print(res) ===== result: ===== 45
3rd Oct 2018, 6:28 PM
strawdog
strawdog - avatar