Open In App

Introduction to Python3

Python is a high-level general-purpose programming language. Python programs generally are smaller than other programming languages like Java. Programmers have to type relatively less and indentation requirements of the language make them readable all the time.

Note: For more information, refer to Python Programming Language



Learn Python 3 from beginners to advanced with our complete tutorial: Python 3 Tutorial

Introduction to Python 3

Difference Between Python2 and Python3

Python 3.0/Python 3000/Py3k is a new version of Python which is incompatible with Python 2.x.(Python 2.0 was released in 2000). Some major features that differ among the two are listed below !! 
 



Print in Python: In Python2, print is a statement while in Python3 print is a function that is a conversion from no brackets to brackets! 

Example : 

In python2 
 




# syntax in Python2,
# invalid for Python3
print "Hello GfG !!"

In python3 
 




# syntax for Python3 
print("Hello GfG !!")




a=1
b=2
print(a <> b)

Output:
 

True

Python3 
 




print('GfG' != 'GfG')

Output:
 

False

Example: 
In python2,
 

try:
   
except valueError :
   

In python3,
 

try:
   
except valueError as err:
   

 

 


Article Tags :