- 3
Write a python program to print the sum of all odd numbers from 1 to 100.
3 odpowiedzi
+ 4
wherearetheavocados , before you are asking for help, you should do a try by yourself. As it looks like a homework, it makes no sense to present a ready code here. this does not help to develop coding skills of the asker.
It will be more helpful to give some hints, how to do a task.
Also do not duplicate a post.
+ 3
a=[]
for i in range(1,101):
if i % 2 == 1:
a.append(i)
sum=0
for j in a:
sum+=j
print("the sum of all odd numbers equal ", sum)
+ 2
Erialdo Meta 🇦🇱
When I wrote the code inside a comment and tried as much as possible to keep the indentation, but when copying the comment and pasting it into the IDE, all you have to do is configure the indentation.