Introduction:
Python is most popular and high level programming language designed by Guido van Rossum in the year of 1991. You can use it to build web development, Game Development, Machine Learning Algorithm, etc and also You can even make robots using python.
Basic syntax of a python program is easy and simple than other programming languages.Python programs can be written using any text editor and should have the extension .py.
Before going further into Python syntax,I recommend you to read about the basics of Python. This Python Tutorial will explain about the basic syntax in Python with example programs.
FREE PDF – Python course content.
First Python Program:
Type the following content at the Python prompt and press the Enter:
Comments in Python:
Comments are denoted by # Python Comments starts with a # Character.Multiple line comments do not exist in Python.
Example:
Quotation in Python:
Python supports the single quote and the double quote.
Joining two lines:
When you want to write a large set of code in a single line you can break the line using backslashcharacter(\).
String Operators:
Concatenation is done with the + operator.
Example:
Strings can be compared with the Operators.
Upper case letters will be returned for using String upper.
returns the length of the string
Arrays:
In Python Arrays are the listed with mixed data types.
Using append for Adding new list in Array:
Example:
Removing element from Array:
Pop method can be used to remove any element from the list.
Example:
Reserved Words:
Python keywords contain lowercase letter only.We cant use this reserved words for identifiers or variable names. Few of them given below,
Example:
Conclusion:
The above mentioned are the basics syntax of Python programming language. As I said before it is simple scripting language which is easy to learn. Python certification training program will help you to learn Python professionally with hands-on real time projects.
Take a Look: Top Reasons to Learn Python
Python is most popular and high level programming language designed by Guido van Rossum in the year of 1991. You can use it to build web development, Game Development, Machine Learning Algorithm, etc and also You can even make robots using python.
Basic syntax of a python program is easy and simple than other programming languages.Python programs can be written using any text editor and should have the extension .py.
Before going further into Python syntax,I recommend you to read about the basics of Python. This Python Tutorial will explain about the basic syntax in Python with example programs.
FREE PDF – Python course content.
First Python Program:
Type the following content at the Python prompt and press the Enter:
print “Welcome”
The output will be - WelcomeComments in Python:
Comments are denoted by # Python Comments starts with a # Character.Multiple line comments do not exist in Python.
Example:
Print(#This is a comment line) #comment line
Quotation in Python:
Python supports the single quote and the double quote.
Print(‘Pythonquation’)
(Or)
Print(“Pythondoublequation”)
Joining two lines:
When you want to write a large set of code in a single line you can break the line using backslashcharacter(\).
String Operators:
Concatenation is done with the + operator.
Example:
x = 2 + float(11.5) #$x=13.5, float
Comparing Strings: Strings can be compared with the Operators.
==, !=, <, >, <=, and >=.
String Functions:string upper():
Upper case letters will be returned for using String upper.
intlen(string):
returns the length of the string
x = leng(string name) #x returns the string length
Arrays:
In Python Arrays are the listed with mixed data types.
Using append for Adding new list in Array:
Example:
x=[] – Denotes Empty
Array
x.append("python")
x.append(3)
print x
The Output will be - ['python', 3]Removing element from Array:
Pop method can be used to remove any element from the list.
Example:
x=[“one”,”two”,”three”,”four”]
x.pop(2)
print x
The Output will be - [“one”,”two”,”four”]Reserved Words:
Python keywords contain lowercase letter only.We cant use this reserved words for identifiers or variable names. Few of them given below,
Example:
With,finally,from,for,print,raise,continue,def,del,else,except
Conclusion:
The above mentioned are the basics syntax of Python programming language. As I said before it is simple scripting language which is easy to learn. Python certification training program will help you to learn Python professionally with hands-on real time projects.
Take a Look: Top Reasons to Learn Python
Nice post.
ReplyDeletealso, check Python training in Nagpur