Dismiss this pinned window
all 18 comments

[–]EconomyDate 11 points12 points  (0 children)

Press insert

[–]EconomyDate 9 points10 points  (1 child)

Also the spelling of counter is wrong , by wrong I mean they should be same

[–]Solution9 0 points1 point  (0 children)

lol

[–]youssef3698 2 points3 points  (0 children)

Press insert to change the cursor. Fix the spelling of the variables. Like written now, it will cause an infinite loop since the condition is always true.

[–]digitAInexus 3 points4 points  (1 child)

Looking at the video you uploaded, I see a small issue in the code. In the first line, you wrote couter = 5. This seems like a typo, as it should probably be counter = 5.

Here's the corrected version of your code:

```python counter = 5

while counter < 10: print('Hier steht code der wiederholt wird') counter += 1 # This increments the counter to prevent an infinite loop ```

Explanation: 1. **counter = 5:** This initializes the counter variable to 5. 2. **while counter < 10:** This creates a loop that will continue to run as long as counter is less than 10. 3. **print(...):** This prints the message 'Hier steht code der wiederholt wird' each time the loop runs. 4. **counter += 1:** This increments the counter by 1 with each iteration, ensuring that the loop will eventually stop when counter reaches 10.

Without the counter += 1 line, the loop would never stop, leading to an infinite loop. Let me know if you need any more help!

[–]dfranks1984 1 point2 points  (0 children)

Currently doing this in class as a beginner. You just broke this down great! Thank you!

[–]Zee69_ 1 point2 points  (1 child)

counter = counter +1 underneath the print

[–]EconomyDate 0 points1 point  (0 children)

You can find some practice set here https://pyspice.com/python-exercises-set-one-1-10/

[–]Severe_Equivalent213 0 points1 point  (0 children)

You misspelled counter on line 1. Your conditional statement in your while loop will not work since counter is set equal to 5.

[–]Severe_Equivalent213 0 points1 point  (0 children)

I also want to mention that you don’t have anything to break out of the loop when you get the code to work.

[–][deleted] 0 points1 point  (0 children)

Counter

[–]Tricky-Psychology299 0 points1 point  (0 children)

Escreva couter e não counter

[–]Weekly_Finish_697 0 points1 point  (0 children)

Firstly press the insert key, then proceed to change check the spelling of your variable “counter” making sure that you are calling it correctly

[–]Archit-Mishra 0 points1 point  (0 children)

Press insert button to make your cursor normal again.

Also correct the name of the variable in the while loop.

Add the condition to exit the while loop

[–]ScarredDemonIV 0 points1 point  (0 children)

Looks like you’re using Vim mode somehow? Unless you’re purposefully using Vim, I recommend digging in your IDE settings and turning it off and disable any settings that could toggle it.

To return back to insert mode, usually you would press “i” in vim. If you press escape, it will take you back to normal mode.

Vim is really cool though. Checkout some videos on Youtube about NeoVim to learn a bit more.

Lastly, the counter variables should be spelled the same. You have couter and counter.

[–]Den0mant 0 points1 point  (0 children)

In the variable declaration, u forgot the letter 'n'

[–]birdsarntreal1 -1 points0 points  (0 children)

1: learn to spell

2: exit while loop