15,907,687 members
See more:
Python
```count = 0
sum = 1
while (count <= 100):
count += 1
print(count)
if (count > 100):
print (sum)```

What I have tried:

I have tried many different options but nothing seems to be working correctly. I am still a beginner coder, so my coding is pretty basic.
Posted
Updated 14-Mar-24 21:00pm
v3

## Solution 1

You did not explain what you excpect and what you get. Anyway...

1. What is the aim of `continue_flag`? I don't see a reason for that. Remove it.
2. Sum of 1 up to xyz: Ok starting with zero is not critical because adding 0 does not change anything. But for nitpickers like me, starting from 1 is the right way.
3. up to 100
anything 'less than' ('<') 100 does not include 100. Therefore <= 100 is most probably your problem

I hope it helps.

Strange: I do not find a english version of Gaußsche Summenformel – Wikipedia[^]

[Edit 1]

[Edit 2]
Simply do something like this
Python
```sum= 0;
count= 1;
while (count <= 100)
sum+= count;
count+= 1;```

// After the above, sum should have the value you expect

v9
Maciej Los 16-Mar-24 16:02pm
5ed!
0x01AA 17-Mar-24 9:25am
Thank you very much Maciej

## Solution 2

This isn't a complex problem, it's designed so a beginner can get it done fairly easily - and learn how to start coding; building the skills he needs. You need to do this for yourself because the next task will be more complex - it assumes that you understood everything here and have the rudiments of the skills you will need. Just copying and pasting 0x01AA's solution doesn't teach you anything, any more than watching the Tour De France will teach you to ride a bicycle.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]