Go to Moodle and Take Quiz 2
Opens at 9:30
Time: 8 minutes
Password:
Comp 118: Introduction to Programming
EDUCATION IS WHAT REMAINS
AFTER you have FORGOTTEN
everything that you LEARNED IN SCHOOL
Wisdom of the Day
Real school is the school of life
Be a lifelong learner
Weather News
2025 4th warmest year in U.S. history was full of deadly weather extremes
https://www.climatecentral.org/climate-matters/2025-in-review-us-temperatures
Globally, 2025 was the 3rd warmest on record, after 2023 and 2024
https://www.ecmwf.int/en/about/media-centre/news/2025/2025-third-warmest-year
Heat Wave Fuels Massive Wildfire In Australia
Temperatures rose as much as 34 degrees above average in Victoria, Australia, where wildfires have already destroyed 750,000 acres and more 100 homes and buildings.
Lessons from Weather/Climate
Class Norms
https://docs.google.com/document/d/1kaooyF2U1JpqbACbTlxTVbfxhhgjkanAAMeAzPl4fpY/edit?usp=sharing
Looking Ahead
Reminders
Today’s Agenda
Login to CodeLab and do a few exercises
Main Goal of the Course
https://runestone.academy/ns/books/published/KenyonComp118Sp26/GeneralIntro/intro-TheWayoftheProgram.html
Topics
The Python programming language
Which way would be faster?
Compiler
Source code (program)
Input x
x= x + 1
output x
Compiler
Machine code (program)
01010010110
CPU
(executes)
Input�data
Output�data
Translator
Source code (program)
Input x
x= x + 1
output x
Interpreter
CPU
(executes translator)
Input�data
Output�data
Interpreter reads one line at a time and executes the operation.
CPU
Computers are machines
Stored Program Computer
WHERE THINGS GO WRONG-3 Types of Errors: T-P-S
Car Analogy to explain types of errors
Foundations of Programming
Aspects of Programming Languages
Goal
Python Programs
Python Objects
Scalar Objects (Literals)
When you type this
The type is shown
Type Conversions (Casting)
Print to console
To show output from code to a user, use print command�
In [11]: 3+2�Out[11]: 5�
In [12]: print(3+2)�5
No “out” because nothing in returned,
Just something printing
Expressions
<object> <operator> <object>
Arithmetic OPERATORS on ints and floats
- if both are ints, result is int
- if either or both are floats, result is float
Result is float
result is int, quotient without remainder�
Simple Operations
Variables and Assignments
variable
value
If we use 22//7, value of expression is 3
Expressions
pi = 3.14159�radius = 2.2�area = pi*(radius**2)
= sign in Programming vs Math
In programming, you do not “solve for x”
pi = 3.14159�radius = 2.2�# area of circle�area = pi*(radius**2)�radius = radius+1
CHANGING BINDINGS
pi = 3.14�radius = 2.2�area = pi*(radius**2)�radius = radius+1
Python Variable Names
The Rules