Here, you will learn about basic syntax of a python program. Basic syntax of a python program is too simple than other languages. Let's take an example, here the following program prints "Hello Python, I am Python Basic Syntax" as output:
# Python Basic Syntax - Example Program print("Hello Python, I am Python Basic Syntax");
Here is the sample output of the above Python program:
As you can see from the above Python program, there is only one statement required to print the string "Hello Python, I am Python Basic Syntax".
Let's take another example demonstrating basic syntax of Python language.
print("This is,\nPython basic syntax\nExample"); print("You will learn all about Python");
If you run the above example, then below is the output, you will see on your output screen.
As you can see from the above output, \n is used to break the line.
You can use input() function to read input from the keyboard in python. Here is an example program, demonstrating, how to get and read input from user in python:
# Python Basic Syntax - Example Program strn = input("Enter your name: ") print("You name is ", strn);
Here is the sample run of the above python program:
Here are list of some more examples, you may like: