Python Syntax, Comments, Variables, Indentation

Execute Python Syntax


As we learned in the past page, Python grammar can be executed by composing straightforwardly in the Command Line:

>>> print("Hello, World!")
Hello, World! 


Or on the other hand by making a python record on the server, utilizing the .py document augmentation, and running it in the Command Line:

C:\Users\Your Name>python myfile.py 


Python Indentation


Space alludes to the spaces toward the start of a code line.

Where in other programming dialects the space in code is for lucidness just, the space in Python is vital.

Python utilizes space to show a square of code.

if 5 > 2:
  print("Five is greater than two!")

 

Python Variables


In Python, factors are made when you relegate a worth to it:

x = 5
y = "Hello, World!"

 
Python has no order for proclaiming a variable.


Comments


Python has remarking capacity with the end goal of in-code documentation.

Remarks start with a #, and Python will deliver the remainder of the line as a remark:

#This is a comment.
print("Hello, World!")

Comments

Popular posts from this blog

THREE LEVELS OF DATA INDEPENDENCE

Python-HackerRank Problem List Comprehensions

Python Problem Solving - Lonely Integer