01– Course Introduction
COMP 125 – Programming with Python
Course Staff
Instructors:
Mehmet Sayar (Sec. 01 & 02)
Çiğdem Gündüz Demir (Sec. 03)
Yasemin Turkan (Sec. 04)
In addition to the instructors, we will have:
Teaching Assistants (TAs)
Section Leaders (SLs)
You will have many opportunities to interact with course staff:
Lectures
Labs
Office hours
Appointments
...
COMP 125 Programming with Python 2
Course Syllabus
Available in KUHub-Learn & KUSIS
Course Description
This course emphasizes computational thinking and programming using
Python.
Students are expected to gain a solid foundation in algorithmic thinking and
structured programming, and perform basic, common computational tasks
easily and efficiently.
The course examines the fundamentals of storage, input and output, control
structures, functions, sequences and lists, file I/O, numerical computation, and
visualization.
COMP 125 Programming with Python 3
Course Communication
KUHub-Learn will be used for communication:
Course content (slides, recordings)
Announcements
Extra materials, useful links
Coding exercises
Lab-related material
Homework assignments and submission
Grades (homework, lab, exam, ...)
YOU ARE EXPECTED TO CHECK KUHub-Learn AND YOUR
E-MAIL INBOX FREQUENTLY!
COMP 125 Programming with Python 4
Course Content
Slides and sample source code will be available in KUHub-Learn prior to
the class
Main teaching material will be the course slides.
(recommended) Think Python by A. B. Downey, any edition. 2nd edition is
available online
https://greenteapress.com/wp/think-python-2e/
https://greenteapress.com/thinkpython2/thinkpython2.pdf
COMP 125 Programming with Python 5
Links for Info and Practice
Python official docs - Python tutorial: https://docs.python.org/3/tutorial/index.html
Real Python: https://realpython.com/
w3resource: https://www.w3resource.com/python-exercises/
w3 schools: https://www.w3schools.com/python/default.asp
Practice Python: https://www.practicepython.org/
GeeksforGeeks: https://www.geeksforgeeks.org/python-programming-examples/
Edabit: https://edabit.com/challenges/python3
Hackinscience: https://www.hackinscience.org/
Project Euler: https://projecteuler.net/about
https://www.reddit.com/r/learnpython/wiki/index/
COMP 125 Programming with Python 6
Course Plan and Grading
Midterms 50% (2 midterms)
Final 25%
Homework 16% (4 assignments)
Labs 5%
Quizzes 4%
Labs:
There will be a weekly lab session, starting with the third week.
In each lab, one or more coding exercises will be assigned to students.
By the end of the lab session, students will submit their work to KUHub-
Learn, which will be graded.
20% of the lab grades will be dropped. (e.g. lowest two)
COMP 125 Programming with Python 7
Exams and Make-up Policy
The midterms and the final will be centrally scheduled by the University and
will be face-to-face. All exams are paper-based, closed-book, closed-notes.
You may bring one A4 cheat sheet (back and front). You should prepare this
cheat sheet in your handwriting. No photocopy is allowed. Cheat sheets will
be collected at the end of exams.
Make-up for the midterms and the final will be given at the end of the
semester to only those students with valid official excuses.
A single, joint make-up exam will be given, which will cover all topics in the
course. Regardless of which exam they missed, all students eligible for a
make-up will take this exam.
COMP 125 Programming with Python 8
Quizzes
There will be in-class pop quizzes during the lectures. In other words, the
quizzes will be given in class without advance notice.
There will be NO make-up for the quizzes you missed. However, at the
end of the semester, we will calculate your total quiz grade after discarding
the lowest 20 percent of the quiz grades.
Note: We will be posting Review Questions periodically for you to practice
more. You will not be submitting the solutions; however, the quiz question will
be selected among these Review Questions. Therefore, we highly recommend
that you work on the Review Questions whenever they are posted.
COMP 125 Programming with Python 9
Homework Assignments and Late Policy
Homework assignments will be posted on KUHub-Learn. The assignments
are to be turned in by 23:59 on the due date also through KUHub-Learn. No
e-mail submissions under any circumstances.
For the late assignments, each student will be given a total of three grace
days (whole or partial) for the whole semester. There will be no penalty for
the late submissions when the student uses his/her grace days. However,
once these late days have been exhausted, no late assignments will be
accepted.
COMP 125 Programming with Python 10
Share Ideas, Not Code!
COMP 125 Programming with Python 11
What is considered cheating?
Taking someone else’s code (entirely or partially), including code from online
resources
Yes, this is cheating.
Talking to friends about code implementation
Yes, this is cheating.
Talking about the solution approach
You can discuss ideas, but not share code or implementation details.
Brainstorming is OK, don’t talk step-by-step
General help with Python
Not cheating
COMP 125 Programming with Python 12
Warning
Generally: If in doubt, ask.
We will compare all your code submissions with:
Previous semesters’ submissions
Current semester’s submissions
Online resources
THERE WILL BE NO TOLERANCE FOR CHEATING OR PLAGIARISM.
YOU WILL BE IMMEDIATELY REPORTED TO THE DISCIPLINARY COMMITTEE.
YOU WILL BE MET WITH DISCIPLINARY ACTION.
Programming is fun!
Please do not rob yourself of the joy of programming!
COMP 125 Programming with Python 13
Tentative Schedule
Welcome and introduction
Variables, data types, expressions, statements
Decision structures and control flow
Repetition structures
Functions and Modules
Strings and string operations
Data structures: lists, dictionaries, and tuples
File I/O
Numpy: arrays, functions, linear algebra & engineering applications
Matplotlib: plotting and visualization
COMP 125 Programming with Python 14
What is Programming?
“How you get computers solve problems”
“Creating a set of instructions to tell a computer how to perform a task”
“Express a task so that it is understood and executed by a computer”
01101010
Human
Problem 10100110 Solution
Instructions
…
Programmer Computer
COMP 125 Programming with Python 15
What is a Program and a Programmer?
“Program: The set of instructions that a computer follows to perform a
task
Commonly referred to as Software
Programmer: A person who can design, create, and test computer
programs
Also known as software developer
Hopefully, you, before the semester ends
COMP 125 Programming with Python 16
What is a Programming Language?
“A programming language is a vocabulary and set of grammatical rules
for instructing a computer or computing device to perform specific
tasks.”
Basically, a programming language allows us (humans) to describe our
instructions to a computer.
Python is a programming language.
COMP 125 Programming with Python 17
Programming is like … cooking!
Let’s make an omelette!
Ingredients: Directions:
2 large eggs 1. Beat eggs until no whites remain.
Salt 2. Season with salt, pepper, and a pinch
Freshly ground black pepper red pepper flakes.
Pinch red pepper flakes 3. Melt butter in a pan and pour in the
2 tbsp. butter beaten eggs to fully cover the entire
1/4 c. shredded cheddar pan.
2 tbsp. freshly chopped chives 4. Use a rubber spatula to drag cooked
edges into the center and tilt pan to get
uncooked parts to the edge.
5. Once the bottom is set, but top is still a
little wet, sprinkle cheese and chives on
one half of omelette and fold.
https://www.delish.com/cooking/recipe-ideas/a24892843/how-to-make-omelet/
COMP 125 Programming with Python 18
Visualized – Just for Fun
COMP 125 Programming with Python 19
Why Learn Python ?
Readable, programmer-friendly programming language
Popular in many disciplines
Data science, artificial intelligence, bioinformatics, machine learning,
economics, social sciences, ...
Rich set of existing libraries, tools, and resources
Easy-to-learn (relatively), runs on most computers
Makes it easier for anyone to be a programmer!
YOU!
COMP 125 Programming with Python 20
Python
Creator of Python, Guido van Rossum defined his goals for Python in 1999:
• An easy and intuitive language just as powerful as major competitors
• Open source, so anyone can contribute to its development
• Code that is as understandable as plain English
• Suitability for everyday tasks, allowing for short development times
Source: https://en.wikipedia.org/wiki/Guido_van_Rossum
COMP 125 Programming with Python 21
Why Learn Python ?
Very high industry demand for
Python programmers!
Google
Instagram
Spotify
Quora
Netflix
Dropbox
Reddit
Amazon
…
https://www.globenewswire.com/news-release/2019/07/11/1881446/0/en/Coding-Dojo-Identifies-the-
Most-In-Demand-Programming-Languages-at-Top-US-Unicorns.html
COMP 125 Programming with Python 22
Cool Applications
Scientific computing, machine learning, data analysis, data visualization
COMP 125 Programming with Python 23
Cool Applications
Graphics
Self-driving cars
Games
Websites and online apps
... and many more!
COMP 125 Programming with Python 24
Programming Environment
Your first task:
Download and install Spyder
https://www.spyder-ide.org/
The latest Spyder comes with
Python 3.12.
If you have an existing
Python environment in your
computer make sure you
have Python version 3.12 or
above.
COMP 125 Programming with Python 25
Programming Environment
Editor Console
(open, edit, run files) (Interactive Use)
COMP 125 Programming with Python 26