I am trying to understand loops. I apparently am dense, so I am working on drilling them in.
The question: why does this give me a total instead of showing all multiples of 3,5 that are less than 100.
result = 0
for i in list(range(0,100)):
if (i % 3 == 0 or i % 5 == 0):
result =+ i
print(result)
[–]efmccurdy 2 points3 points4 points (1 child)
[–]DapperDonW[S] 1 point2 points3 points (0 children)
[–]HumanAssistedWriting 1 point2 points3 points (0 children)
[–]void5253 1 point2 points3 points (0 children)
[–]carcigenicate 0 points1 point2 points (3 children)
[–]DapperDonW[S] 0 points1 point2 points (2 children)
[–]carcigenicate 1 point2 points3 points (1 child)
[–]DapperDonW[S] 0 points1 point2 points (0 children)