Python syntax can be executed by writing directly in the Command Line, or by creating a python file on the server, using the .py file extension, and running it in the Command Line.
pythoncommand (active python language / Enter the python language)
print("Hello, World")this code
#Hello world!For comments and
input("any key to exit...")use for hold the screen after executing the program) :
Note : Here we use
input() function just for hold the screen after executing the program.
In python language ( # ) sing use for comments, all characters after the # and up to the end of the physical line are part of the comment and the Python interpreter ignores them.
Note : We use
print() function for showing some texts/values and
exit() function use for exit from the python.
Python also has extended documentation capability, called docstrings. Docstrings can be one line, or multiline. Following triple-quoted string is also ignored by Python interpreter and can be used as a multiline comments.
The semicolon ( ; ) allows multiple statements on the single line given that neither statement starts a new code block. Here is a sample snip using the semicolon :
name = 'AyaN'; age='24'; print("My name is: " + name + "\n" + "My age is: " + age); input();
\n is help you create a new line.