You are on page 1of 2

Introduction to Python Programming

Brief History of Python


Python History and Versions
 Python laid its foundation in the late 1980s.
 The implementation of Python was started in
December 1989 by Guido Van Rossum at CWI in
Netherland.
 In February 1991, Guido Van Rossum published
the code (labeled version 0.9.0) to alt.sources.
 In 1994, Python 1.0 was released with new
features like lambda, map, filter, and reduce.
 Python 2.0 added new features such as list
comprehensions, garbage collection systems.
 On December 3, 2008, Python 3.0 (also called Writing simple Python program
"Py3K") was released. It was designed to rectify >>> print("Hello, World!") Hello, World!
the fundamental flaw of the language.
 ABC programming language is said to be the if 5 > 2: print("Five is greater than two!")
predecessor of Python language, which was
capable of Exception Handling and interfacing C:\Users\Your Name>python myfile.py
with the Amoeba Operating System. Hello, World!
 The following programming languages influence
Python: The print() function, output formatting
o ABC language. print('I love {} for "{}!"'.format('Geeks', 'Geeks’))
o Modula-3
print('{0} and {1}'.format('Geeks', 'Portal'))
Why the Name Python? print('{1} and {0}'.format('Geeks', 'Portal'))
There is a fact behind choosing the name Python. Guido
van Rossum was reading the script of a popular BBC print(f"I love {'Geeks'} for \"{'Geeks'}!\"")
comedy series "Monty Python's Flying Circus". It was
late on-air 1970s. print(f"{'Geeks'} and {'Portal'}")

Python IDE and other tools Python Variables, Constants and Literals
Python has no command for declaring a variable.
Variables do not need to be declared with any particular
type, and can even change type after they have been set.
x=5
y = "John"
print(x)
print(y)

Casting
If you want to specify the data type of a variable, this can
be done with casting.
x = str(3) # x will be '3'
y = int(3) # y will be 3
z = float(3) # z will be 3.0

Get the Type


x=5
y = "John"
print(type(x))
print(type(y))

Built-in Data Types


Text Type: str
Numeric Types: int, float, complex
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set, frozenset
Boolean Type: bool
Binary Types: bytes, bytearray, memoryview
Comments
#This is a comment
print("Hello, World!")
print("Hello, World!") #This is a comment
"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")

You might also like