PYTHON ESSENTIALS
FOR
BEGINNERS
Joshua Sapalaran
WHAT YOU WILL BE LEARNING...
PYTHON
High-level programming language
Usage:
Web Development
Data Science
Machine Learning
Artificial Intelligence
GUIDO VAN ROSSUM
I created Python
GUIDO VAN ROSSUM
When I was designing Python back in the late
1980s, I was looking for a name that was short,
unique, and slightly mysterious.
I was also a big fan of Monty Python's Flying
Circus, a popular British comedy series from
the 1970s. So, I decided to name my
programming language after Monty Python
because it was a name that was easy to
remember and would hopefully be fun to use.
ADVANTAGES
Simple syntax
Large community
Versatility
TELLING A COMPUTER WHAT TO DO
People
PRINT()
ACTIVITY
Let's say you want to print the following sentences
in three separate lines, how will you do?
Hello there!
Looking to get started with Python?
Worry no more as this course is designed for
beginners.
STRING MANIPULATION
People
STRING
Sequence of characters, like a word or a sentence
STRING MANIPULATION
Joining two strings together
Changing the case of letters
Or splitting a string into smaller parts
INPUT()
People
ACTIVITY
Using only the print() and input() functions, I want
you to produce the following message:
"Hello <name>! Looking to get started with Python?
Worry no more as this course is designed for
beginners."
Hint 1: Ask the user for his/her name
Hint 2: Enclose ____() function inside the ____()
function
VARIABLES AND DATA TYPES
People
VARIABLES
It can hold different type of information such as numbers or text
FORMATTED STRINGS
ACTIVITY
Transform the previous code using formatted
strings.
BUILT-IN FUNCTIONS
People
LEN()
UPPER() AND LOWER()
DATA TYPES
People
DATA TYPES
Integer: whole number
Float: decimal number
String: text or character
Boolean: True or False
MATHEMATICAL OPERATORS
Operator Operation
+ Addition
- Subtraction
* Multiplication
/ Division
// Floor division
** Exponent
CONDITIONAL STATEMENTS
People
CONDITIONAL STATEMENTS
"If this, then do that"
COMPARISON OPERATORS
Operator Operation
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
== Equal
!= Not equal
LOOPS
People
FOR LOOP
Set of instructions that can be repeated many times
without having to write the instructions over and over
again
WHILE LOOP
It only keep doing someting as long as a condition is true
FUNCTION
People
FUNCTION
Set of instructions that performs a specific task
ACTIVITY
I want you to create a function the prints this message
“Hello there! Looking to get started with Python? Worry
no more as this course is designed for beginners.” in
three lines. The output should be:
Hello there!
Looking to get started with Python?
Worry no more as this course is designed for beginners.
ACTIVITY
I want you to create a function for each mathematical
operation—addition, subtraction, multiplication, and
division that accepts three numbers.
LIST, DICTIONARY, AND TUPLE
People
LIST
Ordered collection of values that can be changed or modified
Represented by brackets []
DICTIONARY
Unordered collection of key-value pairs
Represented by curly braces {}
TUPLE
Similar to a list, but is is immutable
Represented by curly braces ()
ACTIVITY
I want you to create a Password Generator using the
topics we’ve discussed today.
Hint 1: You will be using a “random” module. To import a module use
import random
Hint 2: You will be using 3 lists: letters, numbers, and symbols
OBJECT-ORIENTED PROGRAMMING
People
OOP
OOP is a programming paradigm that organizes code into
objects, which are instances of classes
CLASSES
Blueprint that describes how an object should be created
OBJECTS
Instance of a class