All technological notes.
Python syntax can be executed by writing directly in the Command Line or in a python file
Expression: the code that returns a value.
1+1Statement: the operation on a value.
a=1a=1;print(a)Indentation: the spaces at the beginning of a code line.
Python uses indentation to indicate a block of code.
if 5 > 2:
print("Five is greater than two!") #error
if 5 > 2:
print("Five is greater than two!") # one space
if 5 > 2:
print("Five is greater than two!") # eight spaces
You have to use the same number of spaces in the same block of code, otherwise Python will give you an error.
if 5 > 2:
print("Five is greater than two!")
print("Five is greater than two!") #error, should use same number of spaces in the same block