Reply to post:

Q. What's today's top language? A. Python... no, wait, Java... no, C

Clive Galway

I meant what is inside the code block, not what is part of the condition.

numbers = [2, 4, 6, 8]

product = 1

for number in numbers:

....product = product * number

product = product * number is only part of the loop because of it's indenting. This is what I was referring to.

Trying to post some Python code somewhere that does not allow indenting (I cannot figure out how to do it on this site, even pre blocks strip out leading whitespace) and you simply cannot post valid code.

What happens if somehow you end up with source that contains spaces and tabs? The code could then surely APPEAR to mean one thing, but in fact means something completely different.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019