SlideShare a Scribd company logo
Course Overview,
Python Basics
Lecture 1
About Your Instructors
Walker White Dietrich Geisler
• New instructor
§ Taught 1110 this summer
§ First time with a large class
• Will be back next week
8/22/22 Overview, Types & Expressions 2
• Director: GDIAC
§ Game Design @ Cornell
§ Game courses in Spring
• Teach CS 1110 in fall
We Are (Essentially) Full!
• Lecture times are somewhat flexible.
§ Technically have room for ~50 in each
§ We can use this to swap lectures
• Labs/sections at fire code capacity
§ We lost ACCEL labs last years
§ New classrooms are not as flexible
• But lots of drops; watch Student Center!
8/22/22 Overview, Types & Expressions 3
CS 1110 Fall 2022
• Outcomes:
§ Fluency in (Python) procedural programming
• Usage of assignments, conditionals, and loops
• Ability read and test programs from specifications
§ Competency in object-oriented programming
• Ability to recognize and use objects and classes
§ Knowledge of searching and sorting algorithms
• Knowledge of basics of vector computation
• Website:
§ www.cs.cornell.edu/courses/cs1110/2022fa/
4
8/22/22 Overview, Types & Expressions
Intro Programming Classes Compared
CS 1110: Python
• No prior programming
experience necessary
• No calculus
• Slight focus on
§ Software engineering
§ Application design
CS 1112: Matlab
• No prior programming
experience necessary
• One semester of calculus
• Slight focus on
§ Scientific computation
§ Engineering applications
5
8/22/22 Overview, Types & Expressions
But either course serves as
a pre-requisite to CS 2110
CS 1133: Short Course in Python
• 2-credit course in how to use Python
§ Material is roughly the first half of CS 1110
§ Most of the Python of 1110, but not theory
§ Two assignments; no exams
§ No experience required
• This is the only way to take Python S/U
§ CS 1110 is no longer offered S/U (in fall)
§ Best for students that just want Python
8/22/22 Overview, Types & Expressions 6
Why Programming in Python?
• Python is easier for beginners
§ A lot less to learn before you start “doing”
§ Designed with “rapid prototyping” in mind
• Python is more relevant to non-CS majors
§ NumPy and SciPy heavily used by scientists
• Python is a more modern language
§ Popular for web applications (e.g. Facebook apps)
§ Also applicable to mobile app development
8/22/22 Overview, Types & Expressions 7
Class Structure
• Lectures. Every Tuesday/Thursday
§ Not just slides; interactive demos almost every lecture
§ Because of enrollment, please stay with your section
§ Semi-Mandatory. 1% Participation grade from iClickers
• Section/labs. Phillips 318 or Hollister 401
§ Guided exercises with TAs and consultants helping out
• Meets Tuesday/Thursday or Wednesday/Friday
• Only Phillips 318 has computers (bring your laptop)
§ Contact Amy (ahf42@cornell.edu) for section conflicts
§ Mandatory. Missing more than 3 lowers your final grade
8
8/22/22 Overview, Types & Expressions
Class Structure
• Lectures. Every Tuesday/Thursday
§ Not just slides; interactive demos almost every lecture
§ Because of enrollment, please stay with your section
§ Semi-Mandatory. 1% Participation grade from iClickers
• Section/labs. Phillips 318 or Hollister 401
§ Guided exercises with TAs and consultants helping out
• Meets Tuesday/Thursday or Wednesday/Friday
• Only Phillips 318 has computers (bring your laptop)
§ Contact Amy (ahf42@cornell.edu) for section conflicts
§ Mandatory. Missing more than 2 lowers your final grade
9
8/22/22 Overview, Types & Expressions
All Labs will be use the online system.
But they are not intended to be “online”.
Is there a TextBook?
No
8/22/22 Overview, Types & Expressions 10
Is there a TextBook?
No
8/22/22 Overview, Types & Expressions 11
The asynchronous videos
are essentially the textbook
What Do I Need for this Class?
• Laptop Computer
§ Capable of running Python (no ChromeBooks!)
§ Minimum of 8Gb of RAM
• Python Installation
§ Will be using the latest Anaconda version
§ See instructions on website for how to install
• iClicker. Acquire by next Tuesday
§ Credit for answering – even if wrong
§ iClicker App for smartphone is not acceptable
8/22/22 Overview, Types & Expressions 12
What Do I Need for this Class?
• Laptop Computer
§ Capable of running Python (no ChromeBooks!)
§ Minimum of 8Gb of RAM
• Python Installation
§ Will be using the latest Anaconda version
§ See instructions on website for how to install
• iClicker. Acquire by next Tuesday
§ Credit for answering – even if wrong
§ iClicker App for smartphone is not acceptable
8/22/22 Overview, Types & Expressions 13
You can use computers
in Phillips 318 if needed.
What Do I Need for this Class?
• Laptop Computer
§ Capable of running Python (no ChromeBooks!)
§ Minimum of 8Gb of RAM
• Python Installation
§ Will be using the latest Anaconda version
§ See instructions on website for how to install
• iClicker. Acquire by next Tuesday
§ Credit for answering – even if wrong
§ iClicker App for smartphone is not acceptable
8/22/22 Overview, Types & Expressions 14
The only MUST purchase
This Course is OS Agnostic
8/22/22 Overview, Types & Expressions 15
Windows 10
macOS
Catalina
macOS 10.15 or higher
Do NOT Even THINK It!
8/22/22 Overview, Types & Expressions 16
Coming this October
Do NOT Even THINK It!
8/22/22 Overview, Types & Expressions 17
Coming this October
Things to Do Before Next Class
• Visit the course website:
§ www.cs.cornell.edu/courses/cs1110/2022fa/
§ This IS the course syllabus, updated regularly
• Read Get Started
§ Enroll in Ed Discussions
§ Register your iClicker online
§ Sign into CMS and complete Survey 0
§ Install Python and complete Lab 0
§ Take the academic integrity quiz
8/22/22 Overview, Types & Expressions 18
Things to Do Before Next Class
• Visit the course website:
§ www.cs.cornell.edu/courses/cs1110/2022fa/
§ This IS the course syllabus, updated regularly
• Read Get Started
§ Enroll in Ed Discussions
§ Register your iClicker online
§ Sign into CMS and complete Survey 0
§ Install Python and complete Lab 0
§ Take the academic integrity quiz
8/22/22 Overview, Types & Expressions 19
Will talk about this
more next class
Some Words About About Grades
• This class is not curved (in traditional sense)
§ Curve = competition with other students
§ This is about material, not your classmates
• The grades mean something
§ A: mastered material; can be a consultant
§ B: good at material; ready to take 2110
§ C: it is a bad idea to take 2110
§ D: where did you go?
§ F: were you ever here?
8/22/22 Overview, Types & Expressions 20
Some Words About About Grades
• But this is not a weed-out course
§ We know students have different backgrounds
§ Students can do well regardless of experience
• But you may have to work hard!
§ If no experience, budget 10-12 hours of homework a week
8/22/22 Overview, Types & Expressions 21
A B C D/F
All Students 40% 40% 18% 2%
Some Experience 37% 41% 20% 2%
No Experience 32% 42% 24% 2%
42%
28%
Some Words About About Grades
• But this is not a weed-out course
§ We know students have different backgrounds
§ Students can do well regardless of experience
• But you may have to work hard!
§ If no experience, budget 10-12 hours of homework a week
8/22/22 Overview, Types & Expressions 22
A B C D/F
All Students 40% 40% 18% 2%
Some Experience 37% 41% 20% 2%
No Experience 32% 42% 24% 2%
Freshmen, No Exp 37% 39% 24% 0%
42%
28%
Getting Started with Python
• Will use the “command line”
§ OS X/Linux: Terminal
§ Windows: PowerShell
§ Purpose of the first lab
• Once installed type “python”
§ Starts an interactive shell
§ Type commands at >>>
§ Responds to commands
• Use it like a calculator
§ Use to evaluate expressions
8/22/22 Overview, Types & Expressions 23
This class uses Python 3.9
The Basics
8/22/22 Overview, Types & Expressions 24
12.345
42
“Hello!”
integer
Values
Types
Expressions
float (real number)
string (of characters)
34 * (23 + 14)
"Hel" + "lo!"
1.0 / 3.0
Expressions and Values
8/22/22 Overview, Types & Expressions 25
• An expression represents something
§ Python evaluates it, turning it into a value
§ Similar to what a calculator does
• Examples:
>>> 2.2
2.2
>>> (3 * 7 + 1) * 0.1
2.2
Value
Expression
Value
Expression
(Literal)
(Complex)
• Think about + in Python:
>>> 1+2
3
>>> "Hello"+"World"
"HelloWorld"
• Why does + given different answers?
§ + is different on data of different types
§ This idea is fundamental to programming
What Are Types?
8/22/22 Overview, Types & Expressions 26
adds numerically
glues together
A type is both
•a set of values, and
•the operations on them
What Are Types?
8/22/22 Overview, Types & Expressions 27
Example: int
• Values: integers
§ …, –1, 0, 1, …
§ Literals are just digits:
1, 45, 43028030
§ No commas or periods
• Operations: math!
§ +, – (add, subtract)
§ *, // (mult, divide)
§ ** (power-of)
8/22/22 Overview, Types & Expressions 28
Example: int
• Values: integers
§ …, –1, 0, 1, …
§ Literals are just digits:
1, 45, 43028030
§ No commas or periods
• Operations: math!
§ +, – (add, subtract)
§ *, // (mult, divide)
§ ** (power-of)
• Important Rule:
§ int ops make ints
§ (if making numbers)
• What about division?
§ 1 // 2 rounds to 0
§ / is not an int op
• Companion op: %
§ Gives the remainder
§ 7 % 3 evaluates to 1
8/22/22 Overview, Types & Expressions 29
Example: float
• Values: real numbers
§ 2.51, -0.56, 3.14159
§ Must have decimal
§ 2 is int, 2.0 is float
• Operations: math!
§ +, – (add, subtract)
§ *, / (mult, divide)
§ ** (power-of)
• Ops similar to int
• Division is different
§ Notice /, not //
§ 1.0/2.0 evals to 0.5
• But includes //, %
§ 5.4//2.2 evals to 2.0
§ 5.4 % 2.2 evals to 1.0
• Superset of int?
8/22/22 Overview, Types & Expressions 30
float values Have Finite Precision
• Try this example:
>>> 0.1+0.2
0.30000000000000004
• The problem is representation error
§ Not all fractions can be represented as (finite) decimals
§ Example: calculators represent 2/3 as 0.666667
• Python does not use decimals
§ It uses IEEE 754 standard (beyond scope of course)
§ Not all decimals can be represented in this standard
§ So Python picks something close enough
8/22/22 Overview, Types & Expressions 31
float values Have Finite Precision
• Try this example:
>>> 0.1+0.2
0.30000000000000004
• The problem is representation error
§ Not all fractions can be represented as (finite) decimals
§ Example: calculators represent 2/3 as 0.666667
• Python does not use decimals
§ It uses IEEE 754 standard (beyond scope of course)
§ Not all decimals can be represented in this standard
§ So Python picks something close enough
Expressions vs Values
8/22/22 Overview, Types & Expressions 32
int versus float
• This is why Python has two number types
§ int is limited, but the answers are always exact
§ float is flexible, but answers are approximate
• Errors in float expressions can propagate
§ Each operation adds more and more error
§ Small enough not to matter day-to-day
§ But important in scientific or graphics apps
(high precision is necessary)
§ Must think in terms of significant digits
8/22/22 Overview, Types & Expressions 33
Using Big float Numbers
• Exponent notation is useful for large (or small) values
§ –22.51e6 is –22.51 * 106 or –22510000
§ 22.51e–6 is 22.51 * 10–6 or 0.00002251
• Python prefers this in some cases
>>> 0.00000000001
1e-11
A second kind
of float literal
Remember: values
look like literals
8/22/22 Overview, Types & Expressions 34
Example: bool
• Values: True, False
§ That is it.
§ Must be capitalized!
• Three Operations
§ b and c
(True if both True)
§ b or c
(True if at least one is)
§ not b
(True if b is not)
• Made by comparisons
§ int, float operations
§ But produce a bool
• Order comparisons:
§ i < j, i <= j
§ i >= j, i > j
• Equality, inequality:
§ i == j (not = )
§ i != j
8/22/22 Overview, Types & Expressions 35
Example: str
• Values: text, or sequence of characters
§ String literals must be in quotes
§ Double quotes: "Hello World!", " abcex3$g<&"
§ Single quotes: 'Hello World!', ' abcex3$g<&’
• Operation: + (catenation, or concatenation)
§ 'ab' + 'cd' evaluates to 'abcd’
§ concatenation can only apply to strings
§ 'ab' + 2 produces an error
8/22/22 Overview, Types & Expressions 36

More Related Content

Similar to Course Overview Python Basics Course Slides (20)

Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Fwdays
 
Python programming lab 23
Python programming lab 23Python programming lab 23
Python programming lab 23
profbnk
 
ARTDM 171 Web Design: Week 1 Overview
ARTDM 171 Web Design: Week 1 OverviewARTDM 171 Web Design: Week 1 Overview
ARTDM 171 Web Design: Week 1 Overview
Gilbert Guerrero
 
OpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissionsOpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissions
Peter Tröger
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
Benjamin Baumann
 
MULTIMEDIA IN Making for teacher trainees , kisii university
MULTIMEDIA IN Making for teacher trainees , kisii universityMULTIMEDIA IN Making for teacher trainees , kisii university
MULTIMEDIA IN Making for teacher trainees , kisii university
omosa elijah
 
Class One: The Computer
Class One: The ComputerClass One: The Computer
Class One: The Computer
Ian Kane
 
Data Science: Introduction
Data Science: IntroductionData Science: Introduction
Data Science: Introduction
Jinho Choi
 
Learn to Code with MIT App Inventor ( PDFDrive ).pdf
Learn to Code with MIT App Inventor ( PDFDrive ).pdfLearn to Code with MIT App Inventor ( PDFDrive ).pdf
Learn to Code with MIT App Inventor ( PDFDrive ).pdf
NemoPalleschi
 
Getting better through Katas
Getting better through KatasGetting better through Katas
Getting better through Katas
Nola Stowe
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
rsebbe
 
Lec 01 introduction
Lec 01   introductionLec 01   introduction
Lec 01 introduction
UmairMuzaffar9
 
Don't get blamed for your choices - Techorama 2019
Don't get blamed for your choices - Techorama 2019Don't get blamed for your choices - Techorama 2019
Don't get blamed for your choices - Techorama 2019
Hannes Lowette
 
Community and Github: 7/27/2011
Community and Github: 7/27/2011Community and Github: 7/27/2011
Community and Github: 7/27/2011
Andy Lester
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
Bhavin Gandhi
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
Danny Preussler
 
An Introduction to Google Summer of Code 2015
An Introduction to Google Summer of Code 2015An Introduction to Google Summer of Code 2015
An Introduction to Google Summer of Code 2015
Pradeeban Kathiravelu, Ph.D.
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
Derek Jacoby
 
W1-Intro to python.pptx
W1-Intro to python.pptxW1-Intro to python.pptx
W1-Intro to python.pptx
NaziaPerwaiz2
 
200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code
David Danzilio
 
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Fwdays
 
Python programming lab 23
Python programming lab 23Python programming lab 23
Python programming lab 23
profbnk
 
ARTDM 171 Web Design: Week 1 Overview
ARTDM 171 Web Design: Week 1 OverviewARTDM 171 Web Design: Week 1 Overview
ARTDM 171 Web Design: Week 1 Overview
Gilbert Guerrero
 
OpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissionsOpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissions
Peter Tröger
 
MULTIMEDIA IN Making for teacher trainees , kisii university
MULTIMEDIA IN Making for teacher trainees , kisii universityMULTIMEDIA IN Making for teacher trainees , kisii university
MULTIMEDIA IN Making for teacher trainees , kisii university
omosa elijah
 
Class One: The Computer
Class One: The ComputerClass One: The Computer
Class One: The Computer
Ian Kane
 
Data Science: Introduction
Data Science: IntroductionData Science: Introduction
Data Science: Introduction
Jinho Choi
 
Learn to Code with MIT App Inventor ( PDFDrive ).pdf
Learn to Code with MIT App Inventor ( PDFDrive ).pdfLearn to Code with MIT App Inventor ( PDFDrive ).pdf
Learn to Code with MIT App Inventor ( PDFDrive ).pdf
NemoPalleschi
 
Getting better through Katas
Getting better through KatasGetting better through Katas
Getting better through Katas
Nola Stowe
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
rsebbe
 
Don't get blamed for your choices - Techorama 2019
Don't get blamed for your choices - Techorama 2019Don't get blamed for your choices - Techorama 2019
Don't get blamed for your choices - Techorama 2019
Hannes Lowette
 
Community and Github: 7/27/2011
Community and Github: 7/27/2011Community and Github: 7/27/2011
Community and Github: 7/27/2011
Andy Lester
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
Bhavin Gandhi
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
Danny Preussler
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
Derek Jacoby
 
W1-Intro to python.pptx
W1-Intro to python.pptxW1-Intro to python.pptx
W1-Intro to python.pptx
NaziaPerwaiz2
 
200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code
David Danzilio
 

More from MuhammadIfitikhar (9)

Lecture-00: Azure IoT Pi Day Slides.pptx
Lecture-00: Azure IoT Pi Day Slides.pptxLecture-00: Azure IoT Pi Day Slides.pptx
Lecture-00: Azure IoT Pi Day Slides.pptx
MuhammadIfitikhar
 
Lecture-6: Azure and Iot hub lecture.pptx
Lecture-6: Azure and Iot hub lecture.pptxLecture-6: Azure and Iot hub lecture.pptx
Lecture-6: Azure and Iot hub lecture.pptx
MuhammadIfitikhar
 
Python course slides topic objects in python
Python course slides topic objects in pythonPython course slides topic objects in python
Python course slides topic objects in python
MuhammadIfitikhar
 
Python Lecture slides topic Algorithm design
Python Lecture slides topic Algorithm designPython Lecture slides topic Algorithm design
Python Lecture slides topic Algorithm design
MuhammadIfitikhar
 
Python Slides conditioanls and control flow
Python Slides conditioanls and control flowPython Slides conditioanls and control flow
Python Slides conditioanls and control flow
MuhammadIfitikhar
 
Python course lecture slides specifications and testing
Python course lecture slides specifications and testingPython course lecture slides specifications and testing
Python course lecture slides specifications and testing
MuhammadIfitikhar
 
Python Lecture Slides topic strings handling
Python Lecture Slides topic strings handlingPython Lecture Slides topic strings handling
Python Lecture Slides topic strings handling
MuhammadIfitikhar
 
Python Course Lecture Defining Functions
Python Course Lecture Defining FunctionsPython Course Lecture Defining Functions
Python Course Lecture Defining Functions
MuhammadIfitikhar
 
Python Course Functions and Modules Slides
Python Course Functions and Modules SlidesPython Course Functions and Modules Slides
Python Course Functions and Modules Slides
MuhammadIfitikhar
 
Lecture-00: Azure IoT Pi Day Slides.pptx
Lecture-00: Azure IoT Pi Day Slides.pptxLecture-00: Azure IoT Pi Day Slides.pptx
Lecture-00: Azure IoT Pi Day Slides.pptx
MuhammadIfitikhar
 
Lecture-6: Azure and Iot hub lecture.pptx
Lecture-6: Azure and Iot hub lecture.pptxLecture-6: Azure and Iot hub lecture.pptx
Lecture-6: Azure and Iot hub lecture.pptx
MuhammadIfitikhar
 
Python course slides topic objects in python
Python course slides topic objects in pythonPython course slides topic objects in python
Python course slides topic objects in python
MuhammadIfitikhar
 
Python Lecture slides topic Algorithm design
Python Lecture slides topic Algorithm designPython Lecture slides topic Algorithm design
Python Lecture slides topic Algorithm design
MuhammadIfitikhar
 
Python Slides conditioanls and control flow
Python Slides conditioanls and control flowPython Slides conditioanls and control flow
Python Slides conditioanls and control flow
MuhammadIfitikhar
 
Python course lecture slides specifications and testing
Python course lecture slides specifications and testingPython course lecture slides specifications and testing
Python course lecture slides specifications and testing
MuhammadIfitikhar
 
Python Lecture Slides topic strings handling
Python Lecture Slides topic strings handlingPython Lecture Slides topic strings handling
Python Lecture Slides topic strings handling
MuhammadIfitikhar
 
Python Course Lecture Defining Functions
Python Course Lecture Defining FunctionsPython Course Lecture Defining Functions
Python Course Lecture Defining Functions
MuhammadIfitikhar
 
Python Course Functions and Modules Slides
Python Course Functions and Modules SlidesPython Course Functions and Modules Slides
Python Course Functions and Modules Slides
MuhammadIfitikhar
 
Ad

Recently uploaded (20)

Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
Making significant Software Architecture decisions
Making significant Software Architecture decisionsMaking significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Transmission Media. (Computer Networks)
Transmission Media.  (Computer Networks)Transmission Media.  (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | CertivoAI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdfLooking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.pptSAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
Making significant Software Architecture decisions
Making significant Software Architecture decisionsMaking significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Transmission Media. (Computer Networks)
Transmission Media.  (Computer Networks)Transmission Media.  (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | CertivoAI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdfLooking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.pptSAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Ad

Course Overview Python Basics Course Slides

  • 2. About Your Instructors Walker White Dietrich Geisler • New instructor § Taught 1110 this summer § First time with a large class • Will be back next week 8/22/22 Overview, Types & Expressions 2 • Director: GDIAC § Game Design @ Cornell § Game courses in Spring • Teach CS 1110 in fall
  • 3. We Are (Essentially) Full! • Lecture times are somewhat flexible. § Technically have room for ~50 in each § We can use this to swap lectures • Labs/sections at fire code capacity § We lost ACCEL labs last years § New classrooms are not as flexible • But lots of drops; watch Student Center! 8/22/22 Overview, Types & Expressions 3
  • 4. CS 1110 Fall 2022 • Outcomes: § Fluency in (Python) procedural programming • Usage of assignments, conditionals, and loops • Ability read and test programs from specifications § Competency in object-oriented programming • Ability to recognize and use objects and classes § Knowledge of searching and sorting algorithms • Knowledge of basics of vector computation • Website: § www.cs.cornell.edu/courses/cs1110/2022fa/ 4 8/22/22 Overview, Types & Expressions
  • 5. Intro Programming Classes Compared CS 1110: Python • No prior programming experience necessary • No calculus • Slight focus on § Software engineering § Application design CS 1112: Matlab • No prior programming experience necessary • One semester of calculus • Slight focus on § Scientific computation § Engineering applications 5 8/22/22 Overview, Types & Expressions But either course serves as a pre-requisite to CS 2110
  • 6. CS 1133: Short Course in Python • 2-credit course in how to use Python § Material is roughly the first half of CS 1110 § Most of the Python of 1110, but not theory § Two assignments; no exams § No experience required • This is the only way to take Python S/U § CS 1110 is no longer offered S/U (in fall) § Best for students that just want Python 8/22/22 Overview, Types & Expressions 6
  • 7. Why Programming in Python? • Python is easier for beginners § A lot less to learn before you start “doing” § Designed with “rapid prototyping” in mind • Python is more relevant to non-CS majors § NumPy and SciPy heavily used by scientists • Python is a more modern language § Popular for web applications (e.g. Facebook apps) § Also applicable to mobile app development 8/22/22 Overview, Types & Expressions 7
  • 8. Class Structure • Lectures. Every Tuesday/Thursday § Not just slides; interactive demos almost every lecture § Because of enrollment, please stay with your section § Semi-Mandatory. 1% Participation grade from iClickers • Section/labs. Phillips 318 or Hollister 401 § Guided exercises with TAs and consultants helping out • Meets Tuesday/Thursday or Wednesday/Friday • Only Phillips 318 has computers (bring your laptop) § Contact Amy ([email protected]) for section conflicts § Mandatory. Missing more than 3 lowers your final grade 8 8/22/22 Overview, Types & Expressions
  • 9. Class Structure • Lectures. Every Tuesday/Thursday § Not just slides; interactive demos almost every lecture § Because of enrollment, please stay with your section § Semi-Mandatory. 1% Participation grade from iClickers • Section/labs. Phillips 318 or Hollister 401 § Guided exercises with TAs and consultants helping out • Meets Tuesday/Thursday or Wednesday/Friday • Only Phillips 318 has computers (bring your laptop) § Contact Amy ([email protected]) for section conflicts § Mandatory. Missing more than 2 lowers your final grade 9 8/22/22 Overview, Types & Expressions All Labs will be use the online system. But they are not intended to be “online”.
  • 10. Is there a TextBook? No 8/22/22 Overview, Types & Expressions 10
  • 11. Is there a TextBook? No 8/22/22 Overview, Types & Expressions 11 The asynchronous videos are essentially the textbook
  • 12. What Do I Need for this Class? • Laptop Computer § Capable of running Python (no ChromeBooks!) § Minimum of 8Gb of RAM • Python Installation § Will be using the latest Anaconda version § See instructions on website for how to install • iClicker. Acquire by next Tuesday § Credit for answering – even if wrong § iClicker App for smartphone is not acceptable 8/22/22 Overview, Types & Expressions 12
  • 13. What Do I Need for this Class? • Laptop Computer § Capable of running Python (no ChromeBooks!) § Minimum of 8Gb of RAM • Python Installation § Will be using the latest Anaconda version § See instructions on website for how to install • iClicker. Acquire by next Tuesday § Credit for answering – even if wrong § iClicker App for smartphone is not acceptable 8/22/22 Overview, Types & Expressions 13 You can use computers in Phillips 318 if needed.
  • 14. What Do I Need for this Class? • Laptop Computer § Capable of running Python (no ChromeBooks!) § Minimum of 8Gb of RAM • Python Installation § Will be using the latest Anaconda version § See instructions on website for how to install • iClicker. Acquire by next Tuesday § Credit for answering – even if wrong § iClicker App for smartphone is not acceptable 8/22/22 Overview, Types & Expressions 14 The only MUST purchase
  • 15. This Course is OS Agnostic 8/22/22 Overview, Types & Expressions 15 Windows 10 macOS Catalina macOS 10.15 or higher
  • 16. Do NOT Even THINK It! 8/22/22 Overview, Types & Expressions 16 Coming this October
  • 17. Do NOT Even THINK It! 8/22/22 Overview, Types & Expressions 17 Coming this October
  • 18. Things to Do Before Next Class • Visit the course website: § www.cs.cornell.edu/courses/cs1110/2022fa/ § This IS the course syllabus, updated regularly • Read Get Started § Enroll in Ed Discussions § Register your iClicker online § Sign into CMS and complete Survey 0 § Install Python and complete Lab 0 § Take the academic integrity quiz 8/22/22 Overview, Types & Expressions 18
  • 19. Things to Do Before Next Class • Visit the course website: § www.cs.cornell.edu/courses/cs1110/2022fa/ § This IS the course syllabus, updated regularly • Read Get Started § Enroll in Ed Discussions § Register your iClicker online § Sign into CMS and complete Survey 0 § Install Python and complete Lab 0 § Take the academic integrity quiz 8/22/22 Overview, Types & Expressions 19 Will talk about this more next class
  • 20. Some Words About About Grades • This class is not curved (in traditional sense) § Curve = competition with other students § This is about material, not your classmates • The grades mean something § A: mastered material; can be a consultant § B: good at material; ready to take 2110 § C: it is a bad idea to take 2110 § D: where did you go? § F: were you ever here? 8/22/22 Overview, Types & Expressions 20
  • 21. Some Words About About Grades • But this is not a weed-out course § We know students have different backgrounds § Students can do well regardless of experience • But you may have to work hard! § If no experience, budget 10-12 hours of homework a week 8/22/22 Overview, Types & Expressions 21 A B C D/F All Students 40% 40% 18% 2% Some Experience 37% 41% 20% 2% No Experience 32% 42% 24% 2% 42% 28%
  • 22. Some Words About About Grades • But this is not a weed-out course § We know students have different backgrounds § Students can do well regardless of experience • But you may have to work hard! § If no experience, budget 10-12 hours of homework a week 8/22/22 Overview, Types & Expressions 22 A B C D/F All Students 40% 40% 18% 2% Some Experience 37% 41% 20% 2% No Experience 32% 42% 24% 2% Freshmen, No Exp 37% 39% 24% 0% 42% 28%
  • 23. Getting Started with Python • Will use the “command line” § OS X/Linux: Terminal § Windows: PowerShell § Purpose of the first lab • Once installed type “python” § Starts an interactive shell § Type commands at >>> § Responds to commands • Use it like a calculator § Use to evaluate expressions 8/22/22 Overview, Types & Expressions 23 This class uses Python 3.9
  • 24. The Basics 8/22/22 Overview, Types & Expressions 24 12.345 42 “Hello!” integer Values Types Expressions float (real number) string (of characters) 34 * (23 + 14) "Hel" + "lo!" 1.0 / 3.0
  • 25. Expressions and Values 8/22/22 Overview, Types & Expressions 25 • An expression represents something § Python evaluates it, turning it into a value § Similar to what a calculator does • Examples: >>> 2.2 2.2 >>> (3 * 7 + 1) * 0.1 2.2 Value Expression Value Expression (Literal) (Complex)
  • 26. • Think about + in Python: >>> 1+2 3 >>> "Hello"+"World" "HelloWorld" • Why does + given different answers? § + is different on data of different types § This idea is fundamental to programming What Are Types? 8/22/22 Overview, Types & Expressions 26 adds numerically glues together
  • 27. A type is both •a set of values, and •the operations on them What Are Types? 8/22/22 Overview, Types & Expressions 27
  • 28. Example: int • Values: integers § …, –1, 0, 1, … § Literals are just digits: 1, 45, 43028030 § No commas or periods • Operations: math! § +, – (add, subtract) § *, // (mult, divide) § ** (power-of) 8/22/22 Overview, Types & Expressions 28
  • 29. Example: int • Values: integers § …, –1, 0, 1, … § Literals are just digits: 1, 45, 43028030 § No commas or periods • Operations: math! § +, – (add, subtract) § *, // (mult, divide) § ** (power-of) • Important Rule: § int ops make ints § (if making numbers) • What about division? § 1 // 2 rounds to 0 § / is not an int op • Companion op: % § Gives the remainder § 7 % 3 evaluates to 1 8/22/22 Overview, Types & Expressions 29
  • 30. Example: float • Values: real numbers § 2.51, -0.56, 3.14159 § Must have decimal § 2 is int, 2.0 is float • Operations: math! § +, – (add, subtract) § *, / (mult, divide) § ** (power-of) • Ops similar to int • Division is different § Notice /, not // § 1.0/2.0 evals to 0.5 • But includes //, % § 5.4//2.2 evals to 2.0 § 5.4 % 2.2 evals to 1.0 • Superset of int? 8/22/22 Overview, Types & Expressions 30
  • 31. float values Have Finite Precision • Try this example: >>> 0.1+0.2 0.30000000000000004 • The problem is representation error § Not all fractions can be represented as (finite) decimals § Example: calculators represent 2/3 as 0.666667 • Python does not use decimals § It uses IEEE 754 standard (beyond scope of course) § Not all decimals can be represented in this standard § So Python picks something close enough 8/22/22 Overview, Types & Expressions 31
  • 32. float values Have Finite Precision • Try this example: >>> 0.1+0.2 0.30000000000000004 • The problem is representation error § Not all fractions can be represented as (finite) decimals § Example: calculators represent 2/3 as 0.666667 • Python does not use decimals § It uses IEEE 754 standard (beyond scope of course) § Not all decimals can be represented in this standard § So Python picks something close enough Expressions vs Values 8/22/22 Overview, Types & Expressions 32
  • 33. int versus float • This is why Python has two number types § int is limited, but the answers are always exact § float is flexible, but answers are approximate • Errors in float expressions can propagate § Each operation adds more and more error § Small enough not to matter day-to-day § But important in scientific or graphics apps (high precision is necessary) § Must think in terms of significant digits 8/22/22 Overview, Types & Expressions 33
  • 34. Using Big float Numbers • Exponent notation is useful for large (or small) values § –22.51e6 is –22.51 * 106 or –22510000 § 22.51e–6 is 22.51 * 10–6 or 0.00002251 • Python prefers this in some cases >>> 0.00000000001 1e-11 A second kind of float literal Remember: values look like literals 8/22/22 Overview, Types & Expressions 34
  • 35. Example: bool • Values: True, False § That is it. § Must be capitalized! • Three Operations § b and c (True if both True) § b or c (True if at least one is) § not b (True if b is not) • Made by comparisons § int, float operations § But produce a bool • Order comparisons: § i < j, i <= j § i >= j, i > j • Equality, inequality: § i == j (not = ) § i != j 8/22/22 Overview, Types & Expressions 35
  • 36. Example: str • Values: text, or sequence of characters § String literals must be in quotes § Double quotes: "Hello World!", " abcex3$g<&" § Single quotes: 'Hello World!', ' abcex3$g<&’ • Operation: + (catenation, or concatenation) § 'ab' + 'cd' evaluates to 'abcd’ § concatenation can only apply to strings § 'ab' + 2 produces an error 8/22/22 Overview, Types & Expressions 36