Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję0
List of integers (let 1-10). Write code to add the integers and display the sum.(using loop)
2 odpowiedzi
+ 1
print(sum(range(1, 11)))
+ 1
a = range(1,10)
res = 0
for num in a:
res+=num
print(res)
===== result: =====
45