hel l o pyth o n...i ntr o d u cti o n to p y tho n python g en eral p u rp o s e: b u ild an yt h...
TRANSCRIPT
![Page 1: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/1.jpg)
Hello Python!I N T R O D U C T I O N TO P Y T H O N
Hugo Bowne-AndersonData Scientist at DataCamp
![Page 2: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/2.jpg)
INTRODUCTION TO PYTHON
How you will learn
![Page 3: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/3.jpg)
INTRODUCTION TO PYTHON
Python
General purpose: build anything
Open source! Free!
Python packages, also for data science
Many applications and �elds
Version 3.x - https://www.python.org/downloads/
![Page 4: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/4.jpg)
INTRODUCTION TO PYTHON
IPython ShellExecute Python commands
![Page 5: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/5.jpg)
INTRODUCTION TO PYTHON
IPython Shell
![Page 6: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/6.jpg)
INTRODUCTION TO PYTHON
Python ScriptText �les - .py
List of Python commands
Similar to typing in IPython Shell
![Page 7: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/7.jpg)
INTRODUCTION TO PYTHON
Python Script
![Page 8: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/8.jpg)
INTRODUCTION TO PYTHON
Python Script
Use print() to generate output from script
![Page 9: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/9.jpg)
INTRODUCTION TO PYTHON
DataCamp Interface
![Page 10: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/10.jpg)
Let's practice!I N T R O D U C T I O N TO P Y T H O N
![Page 11: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/11.jpg)
Variables and TypesI N T R O D U C T I O N TO P Y T H O N
Hugo Bowne-AndersonData Scientist at DataCamp
![Page 12: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/12.jpg)
INTRODUCTION TO PYTHON
VariableSpeci�c, case-sensitive name
Call up value through variable name
1.79 m - 68.7 kg
height = 1.79
weight = 68.7
height
1.79
![Page 13: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/13.jpg)
INTRODUCTION TO PYTHON
Calculate BMIheight = 1.79
weight = 68.7 height
1.79
BMI =
68.7 / 1.79 ** 2
21.4413
weight / height ** 2
21.4413
bmi = weight / height ** 2
bmi
21.4413
height2weight
![Page 14: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/14.jpg)
INTRODUCTION TO PYTHON
Reproducibility
height = 1.79
weight = 68.7
bmi = weight / height ** 2
print(bmi)
21.4413
![Page 15: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/15.jpg)
INTRODUCTION TO PYTHON
Reproducibility
height = 1.79
weight = 74.2 # <-
bmi = weight / height ** 2
print(bmi)
23.1578
![Page 16: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/16.jpg)
INTRODUCTION TO PYTHON
Python Types
type(bmi)
float
day_of_week = 5
type(day_of_week)
int
![Page 17: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/17.jpg)
INTRODUCTION TO PYTHON
Python Types (2)
x = "body mass index"
y = 'this works too'
type(y)
str
z = True
type(z)
bool
![Page 18: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/18.jpg)
INTRODUCTION TO PYTHON
Python Types (3)
2 + 3
5
'ab' + 'cd'
'abcd'
Different type = different behavior!
![Page 19: Hel l o Pyth o n...I NTR O D U CTI O N TO P Y THO N Python G en eral p u rp o s e: b u ild an yt h in g O p en s o u rce! Free! P yt h o n p ackages , als o fo r d at a s cien ce M](https://reader033.vdocuments.us/reader033/viewer/2022042315/5f040e677e708231d40c1a0a/html5/thumbnails/19.jpg)
Let's practice!I N T R O D U C T I O N TO P Y T H O N