Python Syntax
Introduction
In this Chapter, you will learn about Python syntax. Python programming language is similar to C and C++. Python is not exactly similar but the concept is same and syntax of Python is little different from C and C++.
Now, we execute our program in an interactive mode. It is very simple, just type your Python statement and press Enter. Here, we print a message on the screen “c# corner”, we print the message, using print() function.
Now, we execute our program in an interactive mode. It is very simple, just type your Python statement and press Enter. Here, we print a message on the screen “c# corner”, we print the message, using print() function.
Syntax of print () function
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
It prints the values to a stream or to sys.stdout by default.
Optional keyword arguments are,
- file a file-like object (stream); defaults to the current sys.stdout.
- sep string inserted between the values, default is a space.
- End string appended after the last value, default is a newline.
- Flush whether to forcibly flush the stream or not.

Python first program
To write our first Python program, we just do addition of two numbers in Python by following the steps, given below-
Step 1
Open Python IDLE Python 3.5.1

Press (Ctrl+N) and new file opens.

File is ready and now we have written our program in this file.
Step 2
Python code is written below.
- a=3
- b=5
- c=a+b
- print("sum of a & b is:",c)

Step 3
Save and run the program.
Save and run the program.
Press (Ctrl+Shift+S) to save our program on the location.

Click save button...
Step 4
Run the program and check the output. Press F5 to run the program.

Summary
In this article, you learnt about Python syntax, how to write a program and how to run it.