0% found this document useful (0 votes)
76 views

Phython Day1

This document provides an overview of Day 1 of a Python programming essentials course. It introduces Python as a popular, high-level programming language used for web development, machine learning, and other applications. It also covers Python's object-oriented and procedural paradigms, smaller program size, and readability. Finally, it discusses installing Python and the IDLE integrated development environment and covers basic Python concepts like identifiers, keywords, comments, and input/output.

Uploaded by

Nicko De Guzman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Phython Day1

This document provides an overview of Day 1 of a Python programming essentials course. It introduces Python as a popular, high-level programming language used for web development, machine learning, and other applications. It also covers Python's object-oriented and procedural paradigms, smaller program size, and readability. Finally, it discusses installing Python and the IDLE integrated development environment and covers basic Python concepts like identifiers, keywords, comments, and input/output.

Uploaded by

Nicko De Guzman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

DAY 1 PYTHON PROGRAMMING ESSENTIALS 1

DAY 1
PYTHON BASIC 1
PYTHON PROGRAMMING ESSENTIALS
for experienced programmers with other programming languages like
Python
DAY 1 PYTHON PROGRAMMING ESSENTIALS 2

Python is a high-level, general-purpose and a very


popular programming language.
Python programming language (latest Python 3) is being used
in webdevelopment, Machine Learning applications, along with
all cutting edge technology in Software Industry.
Python Programming Language is very well suited for Beginners,

also C++ and Java.

Python
DAY 1 PYTHON PROGRAMMING ESSENTIALS 3

Python allows programming in Object-Oriented and


Procedural paradigms.
Python programs generally are smaller than other programming
languages like Java. Programmers have to type relatively less and
indentation requirement of the language, makes them readable all
the time.
Python language is being used by almost all tech-giant
companieslike –Google, Amazon, Facebook, Instagram,
Dropbox, Uber… etc.
 GUI Applications (like Kivy, Tkinter, PyQt etc. )

Python Libraries
DAY 1 PYTHON PROGRAMMING ESSENTIALS 4

The biggest strength of Python is huge collection of standard


library which can be used for the following:
 Machine Learning

 Web frameworks like Django (used by YouTube, Instagram, Dropbox)


 Image processing (like OpenCV, Pillow)
 Web scraping (like Scrapy, BeautifulSoup, Selenium)
 Test frameworks
 Multimedia
 Scientific computing
 Text processing and many more..

Python History
DAY 1 PYTHON PROGRAMMING ESSENTIALS 5

It was created by Guido


van Rossum in 1991
Further developed by the Python
Software Foundation
Python 2.0 released in 2000
Python 3.0 released in 2008
Python 2.0 discontinued 2020
Python 3.8.5 (Sept. 2020)

Python History

DAY 1 PYTHON PROGRAMMING ESSENTIALS


6

Python Applications
DAY 1 PYTHON PROGRAMMING ESSENTIALS 7Advantages
Applications
 Presence of third-party modules
 Extensive support libraries(NumPy for  GUI based desktop applications(Games,
numerical calculations, Pandas for data Scientific Applications)
 Web frameworks and applications 
analytics etc)
Enterprise and Business applications
 Open source and community development
 Easy to learn  User-friendly data assigned, it
takes data type)

structures  High-level language  Operating Systems  Language
Dynamically typed language(No need to Development  Prototyping
mention data type based on value

 Object-oriented language  Portable and


Interactive  Portable across Operating
systems

Organizations using Python

DAY 1
PYTHON

PROGRAMMING ESSENTIALS

8Google spider & Search Engine

Python
Interpreter
Installation

Step 1.
Download the latest
python from the
official website
https://www.python.org/downloads/

DAY 1 PYTHON PROGRAMMING ESSENTIALS 9

Python Interpreter
Installation

Step 2:
Run the Python
Installer from
download folder

DAY 1 PYTHON PROGRAMMING ESSENTIALS 10


Python Interpreter
Installation

Step 3:
Make sure to mark
Add Python 3.7 to
PATH.
Click Install Now or
Custom Installation

DAY 1 PYTHON PROGRAMMING ESSENTIALS 11


Python
Interpreter

Installation
Step 4:
Installation Finish!

DAY 1 PYTHON PROGRAMMING ESSENTIALS 12

Python IDLE
DAY 1 PYTHON PROGRAMMING ESSENTIALS 13
IDLE (Integrated Development
and Learning Environment) is an
integrated development
environment (IDE) for Python.
The Python installer for
Windows contains the IDLE
module by default.

Python Editor/IDE
DAY 1 PYTHON PROGRAMMING ESSENTIALS 14

Online Editor/Interpreter
Offline Editor/IDE
 http://ideone.com/  Sublime Text
 https://ide.geeksforgeeks.org/
Notepad / Notepad++
 http://codepad.org/
 PyCharm
 Visual Studio Code
2. Set the environment settings to python
Creating & Executing Python File DAY 1 PYTHON

PROGRAMMING ESSENTIALS 15

1. Open your favorite text editor/IDE

3. Enter your python codes


4. Save the file with .py as extension file type 5. Run the
code using python interpreter
Hello Python!

DAY 1 PYTHON PROGRAMMING ESSENTIALS


16

Python Identifiers
DAY 1 PYTHON PROGRAMMING ESSENTIALS 17

Identifiers are used to identify variable, function, class module or


other object.
It should start with A to Z or a to z or an underscore (_)
followed by zero or more letters, underscore and digits (0 to
9)
Case sensitive

Keywords
DAY 1 PYTHON PROGRAMMING ESSENTIALS True
18

break else and elif


False
continue del

None
class
and or def

not If

assert else elif

Indentation
DAY 1 PYTHON PROGRAMMING ESSENTIALS 19

Python uses indentation to indicate code block

if age>18:
print(“Legal Age”)
else:
print(“Underage”)
Comment
DAY 1 PYTHON PROGRAMMING ESSENTIALS Single line comment (#)
20

#this is a comment
print(“hello world”)

Multi-line comment (”””)


”””
This is comment line 1
This is another comment line 2
This is another comment line 3
”””
print(“hello world”)

Quotations
DAY 1 PYTHON PROGRAMMING ESSENTIALS 21
It accepts single (‘), double (“) and triple (‘’’ or ”””)for text or
string

txt1 = ‘hello'
txt2 = "I am a sentence."
txt2 = """I am another sentence made up of multiple lines."""

Taking input/output
DAY 1 PYTHON PROGRAMMING ESSENTIALS 22

Python provides two inbuilt functions to read the input


from the keyboard
input(prompt)
To display the output on the screen
print(value(s),optional_parameters)
var = input(“Enter your age: ")

Taking input
DAY 1 PYTHON PROGRAMMING ESSENTIALS 23

# Python taking input

print(var)

name = input("Enter your name: ") print("Hi " + name + " your age
is " , var)

Taking multiple inputs DAY 1 PYTHON PROGRAMMING ESSENTIALS 24


# Python taking multiple input val1, val2 = input(“Enter two
value: ").split()print(val1)
print(val2)
num = 12
print("num = ", num)
# softspace feature

Output using print() DAY 1 PYTHON PROGRAMMING ESSENTIALS 25# Using print() function in

Python
# One object is passed
print("Red fox say")

# Two objects are passed

print('P', 'Y', 'T', 'H', 'O', 'N', sep='|')

# Using end argument (no new line)


print("Python", end=" ")
print("for everyone!")

# Print blank line


print("The quick brown fox ", 3 * "\n")
print("jumped over the lazy dog")

1. Allow the user to enter the following


1. Name (Peter Tom)
2. Math Grade (80)
3. Science Grade (84)
4. English Grade (100)
5. Status (Passed or Failed) (Passed)
2. Display the appropriate values
DAY 1 PYTHON PROGRAMMING ESSENTIALS 26

Hi! Peter Tom, your grade on the following subjects areMath :


80, Science : 84, English : 100 Status: Passed

Exercise 1
Filename: Day1_Exe1_Lastname_Firstname.py
1. F-Strings f or F
2. String modulo operator % 3. String Format method { }
Output Formatting
DAY 1 PYTHON PROGRAMMING ESSENTIALS 27 Several ways to present an
output of the program
F-Strings f or F
print(F”The quick {color} {animal}”)

Output Formatting
DAY 1 PYTHON PROGRAMMING ESSENTIALS 28

food = “rice”
pack = 2
print(f”Eat {pack} cup(s) of {food} every meal.”)
animal = input(“Enter animal: ”) color = input(“Enter color: “)
String modulo operator %
print(”1 cup of %s cost %.2f”%(food, prize))

Output Formatting
DAY 1 PYTHON PROGRAMMING ESSENTIALS 29

food = “rice”
prize = 35.6743

male = 40
female = 32
print(”Total students: %d Males: %d Females:”%(male, female))
Output Formatting
DAY 1 PYTHON PROGRAMMING ESSENTIALS 30

String Format method { }


name = “John Doe”
game = “basketball”
food = “pizza”
print(“My name is {} I love {} and playing {}”.format(name, food, game))print("My name is
{0} I love {2} and playing {1}".format(name, game, food))
print("My name is {name} I love {food} and playing {game}".format(food="burger", name="John",
game="chess"))
print("Premium amount: Php {:,}".format(preAmt))

Output Formatting
DAY 1 PYTHON PROGRAMMING ESSENTIALS 31
String Format method { }
preAmt = 4521.35462
policy = "Insurance"
holder = "Will Smith"
#format specifier
print("Premium amount: {:.3f}".format(preAmt))

print("{:<20}{:^15}{:>10}".format("Name", "Policy", "Amount"))


print("{:<20}{:^15}{:>10}".format(holder, policy, preAmt))

1. Allow the user to enter the following: a. Water


Charge
DAY 1 PYTHON PROGRAMMING ESSENTIALS 32

b. Sewage Charge
c. Electric Charge
d. City Tax
2. Display the result with the given format below Water Charge
118 peso(s) 25 cent(s)
Sewage Charge 20 peso(s) 8 cent(s)
Electric Charge 1250 peso(s) 76 cent(s)
City Tax 50 0 cent(s)

Exercise 2
Filename: Day1_Exe2_Lastname_Firstname.py

Summary
DAY 1 PYTHON PROGRAMMING ESSENTIALS 33

Introduction
Installation of Python Interpreter
Familiarization on Code Editor and IDE Creating
first Python program Identifiers
Basic Syntax
Taking input/output
Output Formatting

You might also like