G
20

Appreciation post: My first Python script printed something totally wrong for 2 hours

I wrote a loop to count to 10, but it kept printing '1' over and over. Turns out I put the print statement inside the wrong set of curly braces. Anyone have a good trick for keeping track of those brackets?
2 comments

Log in to join the discussion

Log In
2 Comments
blake432
blake43221d ago
Curly braces in Python? That's a new one. Are you maybe mixing up languages like JavaScript? Python uses indentation to show what's inside a loop. Getting the print statement's spacing right is the actual key.
2
nathanwalker
That indentation thing tripped me up for weeks.
6