2 Réponses
+ 3
other programming laquages use { code } where python uses indentation. Some way or an other you need to tell where a function, loop, ... begins and ends.
Try this:
n =1
list = [1,2,3]
for i in list:
n = n*i
print(n)
# outputs 3 numbers
for i in list:
n = n*i
print(n)
# outputs 1 number
+ 1
The syntax of Python requires indentation.
If you really want the {code} syntax, try typing
from __future__ import braces
in your interpreter and see what it tells you...