Thanks to visit codestin.com
Credit goes to www.slideshare.net

PYTHON
PROGRAMMING
Chapter 0
Python Overview
Topic
• Python Introduction
• What is Python?
• Story of Python
• Why Python
• Use of Python
• Python Download + Installation
• How to Use? + Online Course
Resource
• First Program - Hello World
• Comment
• Variable + Data Type
• Variable Naming Convention
• Input/ Output
• Type Casting
• Built in Function
PYTHON
PROGRAMMING
Chapter 0
Lecture 0.0
Python Introduction
Python – What is?
• Object Oriented
• High Level
• General Purpose Programming Language
• Interpreted
• Dynamic Semantics
Python – Story
• Created by Guido van Rossum
• The name Python was inspired by the BBC TV show Monty Python's
Flying Circus
• Implementation began in December 1989
• Initial Release (labeled version 0.9.0) => 20 February 1991
• Python 1.0 => January 1994
• Python 2.0 => 16 October 2000
• Python 3.0 => 3 December 2008
Python – Why?
• Easy to learn
• Open source
• One of the most influential programming languages
Python - Use
• Scientific and Numeric analysis
• Web Development
• Desktop GUIs
• Data Science
• Artificial Intelligence
• Machine Learning
• Data Analysis
• Data Visualization
Python – Download
Python – Installation
Python – Installation
Python – Installation Page 2
Python – Installation Page 3
Python – After Installation
Python – Installation – IDE Interface
Python – Installation – IDE Interface
Python – Installation – IDE Interface
Python – Installation – IDE Interface
Python – Installation – IDE Interface
Any Question?
Like, Comment, Share
Subscribe
PYTHON
PROGRAMMING
Chapter 0
Lecture 0.1
Variable, Data Type, Expression
Create First Python Program File
• Python IDLE
• File -> New File -> Save (/Save As) -> Hello.py
• Write Python Program
• Run -> Run Module (/F5)
Write First Python Program
print("Hello World")
Comment
# Single Line Comment
"""
Multi
Line
Comment
"""
First Python Program Modified 1
# First Python Program
# Program Name: Hello World
# Author Name: Mun Al Mamun
# A Program to Print a text
print("Hello World")
First Python Program Modified 2
"""
First Python Program
Program Name: Hello World
Author Name: Mun Al Mamun
A Program to Print a text
"""
print("Hello World")
Variable
• Symbolic name to store date in computer program
Data Type
• Integer => 0, 2, 20038, -332
• Float => 5.5, 3.1416, -40.56
• String => Hello World, This is 2019
• Boolean => True, False
Variable (Integer)
# Integer Variable
my_roll = 50
print(my_roll)
Variable (Integer) + Data Type
# Integer Variable with Data Type
my_roll = 50
print(my_roll)
print(type(my_roll))
Variable (Float) + Data Type
# Float Variable with Data Type
my_gpa = 4.5
print(my_gpa)
print(type(my_gpa))
Variable (String) + Data Type
# String Variable with Data Type
my_name = "My Name is Mun"
print(my_name)
print(type(my_name))
Variable (Boolean) + Data Type
# Boolean Variable with Data Type
test = True
print(test)
print(type(test))
Variable (Boolean) + Data Type [2]
# Boolean Variable with Data Type
test = False
print(test)
print(type(test))
NoneType
# NoneType Variable with Data Type
value = None
print(value)
print(type(value))
Data Type
• str (String)
• int (Integer)
• float (Float)
• bool (Boolean)
• None (NoneType)
Variable Naming Convention
• Must begin with a letter (a - z, A - B) or underscore (_)
• Other characters can be letters, numbers or _
• Variable names are case-sensitive
• Variables should be all lowercase
• Words in a variable name should be separated by an underscore
• Don't start name with a digit.
• Never use special symbols like !, @, #, $, %
• Reserved words cannot be used as a variable
https://visualgit.readthedocs.io/en/latest/pages/naming_convention.html
Practice Problem 0.1
1. Declare a Integer variable and print value with data type
2. Declare a Float variable and print value with data type
3. Declare a String variable and print value with data type
4. Declare a Boolean variable and print value with data type
5. Declare a NoneType variable and print value with data type
Any Question?
Like, Comment, Share
Subscribe
PYTHON
PROGRAMMING
Chapter 0
Lecture 0.2.1
Input Output (String)
Input/Output 1
# input a String
name = input()
print(name)
Input/Output 1 (Con.)[Display Message 1]
#input a String
print("Input Your Name")
name = input()
print(name)
Input/Output 1 (Con.)[Display Message 2]
#input a String
name = input("Input Your Name: ")
print(name)
Input/Output + Data Type
#input a String
name = input("Input Your Name: ")
print(name)
print(type(name))
Input Your Name
# Solution 1:
# input a String and Display the String
name = input()
print(name)
# Solution 2:
# input a String with Message in print()
print("Input Your Name")
name = input()
print(name)
# Solution 3:
# input a String with Message in input()
name = input("Input Your Name: ")
print(name)
# Solution 4:
#input a String and Know Datatype
name = input("Input Your Name: ")
print(name)
print(type(name))
Practice Problem 0.2
1. Input your Name and print the value
2. Input your Name with a massage and print the value
3. Input your Name with a massage in input() function and
print the value
4. Input your Name with a massage in input() function and
print the value with data type
Any Question?
Like, Comment, Share
Subscribe
PYTHON
PROGRAMMING
Chapter 0
Lecture 0.2.2
Input Output (Number)
Input an Integer Number
age = input()
print(age)
Input an Integer Number [Con.][Data Type]
age = input()
print(age)
print(type(age))
• All Input is String in Python
• We have to Type Cast to convert String into Integer.
Input an Integer Number (*)
age = input()
print(age)
print(type(age))
# Type Cast to Integer Number
age = int(age)
print(age)
print(type(age))
Input an Integer Number [Final]
age = int(input())
print(age)
print(type(age))
Input an Float Number
gpa = input()
print(gpa)
print(type(gpa))
Input an Float Number (*)
gpa = input()
print(gpa)
print(type(gpa))
# Type Cast to Float Number
gpa = float(gpa)
print(type(gpa))
print(gpa)
Input an Float Number [Final]
gpa = float(input())
print(gpa)
print(type(gpa))
Built-in Function
• print()
• input()
• type()
• int()
• float()
Built-in Function
source: https://docs.python.org/3.6/library/functions.html
Practice Problem 0.3
1. Input your age and print data with type (Be sure about
type conversion to integer)
2. Input your gpa and print data with type (Be sure about
type conversion to float)
Any Question?
Like, Comment, Share
Subscribe
PYTHON
PROGRAMMING
Chapter 0
Lecture 0.2.3
Formatted Input Output
Formatted I/O
name = input("What is Your Name: ")
print("Hello,", name)
roll = int(input("What is Your Roll: "))
print("Your roll is:", roll)
gpa = float(input("What is Your GPA: "))
print("Your GPA is", gpa)
Formatted I/O 2
name = input("What is Your Name: ")
roll = int(input("What is Your Roll: "))
gpa = float(input("What is Your GPA: "))
print(name,roll,gpa)
Formatted I/O 3
#Input Name with Formatted Output
name = input("What is Your Name: ")
1. print("Hello,",name)
2. print("Hello,", name, "How are You", name, "?")
3. print("Hello,", name, "nHow are You", name, "?")
4. print("Hello, {}nHow are You {}?".format(name,name))
5. print(f"Hello, {name}nHow are You {name}?")
Any Question?
Like, Comment, Share
Subscribe
Chapter 0 Python Overview (Python Programming Lecture)

Chapter 0 Python Overview (Python Programming Lecture)