-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_syntax.py
25 lines (20 loc) · 1.04 KB
/
2_syntax.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Python Syntax
# As we learned in the previous page, Python syntax can be executed by writing directly in the Command Line.
print("Hello, World!")
# Or by creating a python file on the server, using the .py file extension, and running it in the Command Line.
'''
python myfile.py
'''
print('----------------------------------------------------------------')
# Python Indentation
'''
Indentation refers to the spaces at the beginning of a code line.
Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.
Python uses indentation to indicate a block of code.
'''
if 5 > 2:
print("Five is greater than two!")
print("Five is greater than two!")
# Python will give you an error if you skip the indentation.
# Note - The number of spaces is up to you as a programmer, the most common use is four, but it has to be at least one.
# note - You have to use the same number of spaces in the same block of code, otherwise Python will give you an error.