0% found this document useful (0 votes)
9 views21 pages

Slides Chapter1

This document serves as an introduction to Python, covering its general purpose, open-source nature, and applications in various fields, particularly data science. It explains the use of the IPython Shell and Python scripts for executing commands and generating output, as well as fundamental concepts like variables, types, and calculating BMI. The document emphasizes reproducibility in coding and showcases different data types in Python.

Uploaded by

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

Slides Chapter1

This document serves as an introduction to Python, covering its general purpose, open-source nature, and applications in various fields, particularly data science. It explains the use of the IPython Shell and Python scripts for executing commands and generating output, as well as fundamental concepts like variables, types, and calculating BMI. The document emphasizes reproducibility in coding and showcases different data types in Python.

Uploaded by

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

INTRODUCTION TO PYTHON

Hello Python!
INTRODUCTION TO PYTHON

Hugo Bowne-Anderson
Data Scientist at DataCamp
How you will learn

INTRODUCTION TO PYTHON
Python

General purpose: build anything Open


source! Free!
Python packages, also for data science Many
applications and fields

INTRODUCTION TO PYTHON
IPython Shell
Execute Python commands

Execute Python commands

INTRODUCTION TO PYTHON
IPython Shell

INTRODUCTION TO PYTHON
IPython Shell

INTRODUCTION TO PYTHON
Python Script
Text files - .py

List of Python commands


Similar to typing in IPython Shell

INTRODUCTION TO PYTHON
Python Script

INTRODUCTION TO PYTHON
Python Script

Use print() to generate output from script

INTRODUCTION TO PYTHON
DataCamp Interface

INTRODUCTION TO PYTHON
Let's practice!
INTRODUCTION TO PYTHON

Variables and Types


INTRODUCTION TO PYTHON

Hugo Bowne-Anderson
Data Scientist at DataCamp
Variable
Specific, case-sensitive name
Call up value through variable name
1.79 m - 68.7 kg

height = 1.79
weight = 68.7
height

1.79

INTRODUCTION TO PYTHON
Calculate BMI
height = 1.79 68.7 / 1.79 ** 2
weight = 68.7
height
21.4413

1.79
weight / height ** 2

weight
21.4413
BMI = height2

21.4413

INTRODUCTION TO PYTHON
bmi = weight / height ** 2
bmi

Reproducibility
height = 1.79
weight = 68.7
bmi = weight / height ** 2
print (bmi)

21.4413

INTRODUCTION TO PYTHON
Reproducibility
height = 1.79
weight = 74.2 # <-
bmi = weight / height ** 2
print (bmi)

23.1578

Python Types
type (bmi)

INTRODUCTION TO PYTHON
float

day_of_week = 5
type (day_of_week )

int

INTRODUCTION TO PYTHON
Python Types (2)
x = "body mass index"
y = 'this works too'
type (y)

str

z = True
type (z)

INTRODUCTION TO PYTHON
bool

Python Types (3)


2 + 3

'ab' + 'cd'

'abcd'

INTRODUCTION TO PYTHON
Different type = different behavior!

INTRODUCTION TO PYTHON
Let's practice!
INTRODUCTION TO PYTHON

You might also like