01 - Intro to
Python
Student Machine Learning Coalition
INTRODUCTION
A small history of Python
as a language and why it
is so important.
01
VARIABLES/DATA
TYPES
A short description of
variables and types of 02
variables
TABLE OF LIST ACCESSION
LOOPS/
CONDITIONALS
CONTENT 04 Lists and how to access
elements of a list
Types of loops and basic
logical statements 03 S LIST
COMPREHENSION
05 How to create lists with
one line of code
FUNCTIONS/
LAMBDA
06 How to create functions
and how to compress
them into a single line
expression
01
INTRODUCTION
What is Python?
Popular language created for simplicity and readability
Case and indent sensitive
Source: Wikimedia Commons
Importance
Good for data-usage, visualization, and science
Source: Maker Portal
02
VARIABLES/DATA
TYPES
Basic Data Types
Returns a truth value. A decimal number.
- True or False - Even a regular
number with a
decimal is a float.
Booleans
Float
Regular numbers.
- No decimals, can
be positive or Line of text
negative - Set off by single
Integers quotes or double
quotes.
String
Data Conversion Functions
Bool()
- Turns a variable
into a Boolean
value
Float()
- Turns a variable
into a float
(cannot work with
letters)
Str()
- Turns a variable
into a string
Int()
- Turns a variable
into an integer
(cannot work with
letters or a float
with a decimal
value)
Applications of conversion
Input
function
Use input() to take an
input from the user.
Since it is by default a
string, you can use
float() or int() to
convert to a data type
Type
of your choice.
function
Use type() to check the
datatype of any
variable
03
LOOPS /
CONDITIONAL
STATEMENTS
Basics
A loop is a repeated piece of code, usually until a variable meets a
condition or a certain amount of iterations.
Source: Geeks for Geeks
While Loops
Syntax:
while [condition]:
[action]
[update condition]
Until the condition is met, the action will keep repeating.
For Loops
Syntax:
for [variable] in range([count)]:
[repetitive action]
Note: variable automatically updates
Range(x) - cycles through the numbers from 0 to x-1
If - Else Statements
Syntax:
If [condition]:
[action]
elif [condition]:
[action]
else:
[action]
Conditions can be equality (==), greater than (<), less than (>), and much
more.
04
LISTS - BASICS, ACCESSION
Lists and Tuples - Basics
Tuples - set of two values enclosed by parentheses (ex: (0,1))
Lists - set of multiple values enclosed by brackets (ex:
[1,2,3,4,5,6,7])
Tuples and Lists can be held by one variable!
Lists
- Another type of variable/data
- Important in basic python because it holds multiple values with one
variable
- Important for keeping track of inputs or creating rudimentary
datasets
- Other data types like arrays and series are based on it
Accession: Indexing
Index: the position of a certain item in the list
Syntax: list_name[index]
Indexing (cont.)
More syntax:
Basic List Functions
listname.count(item) - count the amount of times item shows up
listname.append(item) - adds the item at the end of the list
listname.remove(item) - removes item
listname.pop(index) - removes item at the specified index
05
LIST
COMPREHENSION
What is list comprehension?
Creating lists in only one line!
- The loops, equations, and conditions you need can be
condensed into one line of code
- This makes code more organized and compact!
Basic Syntax
Syntax = listname = [expression for variable in range ([range])]
Ex: numbers = [a for a in range(1,6)] gets the numbers from 1 to 5
The list gets saved in the ‘numbers’ variable
Source: Towards Data Science
More examples!
Using an if statement:
even_numbers = [i for i in range (1,10) if i%2==0]
Using an if else statement to determine the expression:
even_or_odd= ["Even" if i%2==0 else "Odd" for i in range(10)]
06
FUNCTIONS AND
LAMBDA
Functions
block of code specified under one name (like
variable) that runs when you call the name
Basic Syntax and Outputs
Basic syntax:
def name (parameters):
[code]
return [value] (optional!)
When calling a function to use it:
name(arguments)
Note: a parameter is the variable name used INSIDE the function
(using the letter ‘x’ to denote input) while an argument is the
ACTUAL input that gets passed to the parameter (using the input
function and getting a number (y) that you use)
Lambda Functions
Lambda [expression]: [equation/manipulation]
Example: lambda x : x+2
Lambda functions are a great way to condense functions into one
line.
Thank you!
2nd ANNOUNCEMENT
MARS
Despite being
red, Mars is a
cold place, not
hot
NEPTUNE
Neptune is the farthest planet from the
Sun, the fourth-largest in our Solar
System
JUPITER SATURN
It’s a gas giant Saturn is a gas
and the biggest giant, composed
planet in our of hydrogen and
Solar System helium
IN DEPTH
MERCURY
Mercury is the closest planet to the Sun
and the smallest one in the Solar System
—it’s only a bit larger than our Moon.
The planet’s name has nothing to do
with the liquid metal, since it was named
after the Roman messenger god,
Mercury
IN DEPTH
MARS MERCURY VENUS JUPITER
VENUS
Venus has a beautiful name and is the
second planet from the Sun. It’s terribly
hot—even hotter than Mercury—and its
atmosphere is extremely poisonous. It’s
the second-brightest natural object in the
night sky after the Moon
If you want to modify these graphs, click on
them, follow the link, change the data and
replace them
CONTENTS OF THIS
TEMPLATE
Here’s what you’ll find in this Slidesgo template:
1. A slide structure based on a newsletter, which you can easily adapt to your
needs. For more info on how to edit the template, please visit Slidesgo School
or read our FAQs.
2. A thanks slide, which you must keep so that proper credits for our design are
given.
3. A resources slide, where you’ll find links to all the elements used in the
template.
4. Instructions for use.
5. Final slides with:
● The fonts and colors used in the template.
● A selection of illustrations. You can also customize and animate them as
you wish with the online editor. Visit Storyset to find more.
● More infographic resources,
You can delete this slide when whose sizeediting
you’re done and color can be edited.
the presentation.
● Sets of customizable icons of the following themes: general, business,
avatar, creative process, education, help & support, medical, nature,
OUR NUMBERS
500 new clients last semester
10 ongoing projects
0
40 new employees last
semester
SECTOR NEWS
Despite being red, Mars is a
cold place, not hot. It’s full
of iron oxide dust, which
gives the planet its reddish
cast
VENUS MARS SATURN
Venus has a beautiful Yes, this is the ringed one.
name and is the second It’s a gas giant, composed
planet from the Sun. It’s mostly of hydrogen and
terribly hot, even hotter helium. It’s named after the
than Mercury Roman god of wealth and
agriculture
NEWS
NEPTUNE MARS MERCURY
Neptune is the Despite being red, Mercury is the closest
farthest planet from Mars is a cold place, planet to the Sun and
the Sun and the not hot. It’s full of iron also the smallest one
fourth-largest in our oxide dust, which in our Solar System
Solar System gives the planet its
reddish cast
JUPITER VENUS SATURN
Jupiter is the biggest Venus has a beautiful Saturn is the ringed
planet in our Solar name and is the planet. It’s a gas
System and also the second planet from giant, composed
fourth-brightest object the Sun. It’s terribly mostly of hydrogen
in the sky hot, even hotter than and helium
Mercury
CUSTOMER REVIEWS
“Neptune is the
farthest planet from the
Sun and the fourth-
largest in our Solar
System!” “Despite being red,
RICHARD Mars is a cold place. It’s
ROE full of iron oxide dust,
which gives the planet
its reddish cast”
HELENA
PATTERSON
TABLE
ISSUE 1 ISSUE 2 ISSUE 3 ISSUE 4
VENUS 12 32 23 45
MERCURY 67 23 45 65
MARS 67 49 78 34
WELCOME!
MARY RUIZ JOHN SMITH
Neptune is the Despite being red,
farthest planet from Mars is a cold place,
the Sun and the not hot. It’s full of iron
fourth-largest in our oxide dust, which
Solar System gives the planet its
reddish cast
JONATHAN DOE MINA HAWKINS
Mercury is the Venus has a beautiful
closest planet to the name and is the
Sun and the smallest second planet from
one in our Solar the Sun. It’s terribly
System hot, even hotter than
Mercury
AWESOME WORDS
REVIEW OF PAST EVENTS
Despite being Jupiter is the
red, Mars is a biggest planet
cold place, not in our Solar
hot System
FEB 02 APR
16
JAN 14 MAR MAY
10 30
Mercury is the Saturn is Neptune is the
closest planet composed of farthest planet
to the Sun hydrogen and from the Sun
helium
UPCOMING EVENTS
SEP 08
Mercury is the
closest planet NOV 29
to the Sun
Saturn is
composed of
hydrogen and
OCT 16 helium
Despite being
red, Mars is a DEC 10
cold place, not
hot Jupiter is the
biggest planet
in our Solar
System
SNEAK PEEK
Neptune is the farthest planet from the
Sun and the fourth-largest in our Solar
System
THANKS
Does anyone have any questions?
[email protected]
+91 620 421 838
yourcompany.com
CREDITS: This presentation template was created by
Slidesgo, including icons by Flaticon, and infographics
& images by Freepik.
Please keep this slide for attribution.
RESOURCES
Did you like the resources on this template? Get them for free at our
other websites.
VECTORS
■ Technology background with gradient colors
■ Blue 5g concept background
■ Abstract landing pages with technology devices
PHOTOS
■ Woman using smartphone with hologram
■ Happy businesswoman looking at camera with holding pencil and dia
ry
■ Portrait of smiling man holding digital tablet looking at camera
■ Smiling bearded man holding disposable coffee cup while opening do
or
■ Portrait of pretty woman holding laptop looking at camera
■ Motherboard with optical fiber
Instructions for use (free users)
In order to use this template, you must credit Slidesgo by keeping the Thanks slide.
You are allowed to:
● Modify this template.
● Use it for both personal and commercial purposes.
You are not allowed to:
● Sublicense, sell or rent any of Slidesgo Content (or a modified version of Slidesgo Content).
● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in
any other product or service that offers downloadable images, icons or presentations that may be subject to
distribution or resale.
● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this
Template.
● Delete the “Thanks” or “Credits” slide.
● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an
intellectual property registry or similar.
For more information about editing slides, please read our FAQs or visit Slidesgo School:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Instructions for use (premium users)
In order to use this template, you must be a Premium user on Slidesgo.
You are allowed to:
● Modify this template.
● Use it for both personal and commercial purposes.
● Hide or delete the “Thanks” slide and the mention to Slidesgo in the credits.
● Share this template in an editable format with people who are not part of your team.
You are not allowed to:
● Sublicense, sell or rent this Slidesgo Template (or a modified version of this Slidesgo Template).
● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in
any other product or service that offers downloadable images, icons or presentations that may be subject to
distribution or resale.
● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this
Template.
● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an
intellectual property registry or similar.
For more information about editing slides, please read our FAQs or visit Slidesgo School:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Fonts & colors used
This presentation has been made using the following fonts:
Exo 2
(https://fonts.google.com/specimen/Exo+2)
Roboto Condensed
(https://fonts.google.com/specimen/Roboto+Condensed)
#416d90 #6ebdc4 #b4ebf0 #ffffff
Storyset
Create your Story with our illustrated concepts. Choose the style you like the most, edit its colors, pick the
background and layers you want to show and bring them to life with the animator panel! It will boost your
presentation. Check out How it Works.
Pana Amico Bro Rafiki Cuate
Use our editable graphic resources...
You can easily resize these resources without losing quality. To change the color, just ungroup the resource
and click on the object you want to change. Then, click on the paint bucket and select the color you want.
Group the resource again when you’re done. You can also look for more infographics on Slidesgo.
JANUARY FEBRUARY MARCH APRIL MAY JUNE
PHASE 1
Task 1
Task 2
PHASE 2
Task 1
Task 2
JANUARY FEBRUARY MARCH APRIL
PHASE
1
Task 1
Task 2
...and our sets of editable icons
You can resize these icons without losing quality.
You can change the stroke and fill color; just select the icon and click on the paint bucket/pen.
In Google Slides, you can also use Flaticon’s extension, allowing you to customize and add even more icons.
Educational Icons Medical Icons
Business Icons Teamwork Icons
Help & Support Icons Avatar Icons
Creative Process Icons Performing Arts Icons
Nature Icons
SEO & Marketing Icons