W1-Introduction_03042025
W1-Introduction_03042025
ECE 035.001
W1 - Introduction
Jaeyoung Do
[email protected]
2014.03 ~ 2016.09 Senior Scientist: Microsoft Jim Gray Systems Lab (GSL)
[email protected]
2024.02 ~ Current Assistant Professor: Seoul National Univ. ECE & IPAI
https://aidas.snu.ac.kr
2
Research Interests
• Conducting innovative research on AI (LLM) technology from the
perspectives of Algorithm, Data-oriented Systems, and Application.
Healthcare
CoreAI
Manufacturing
VerAI
3
In this course…
• Fundamental Programming Concepts – Students will learn the basics of
programming using Python, including variables, control structures,
functions, and data structures.
4
People
• Instructor
– Jaeyoung Do (도재영)
– [email protected]
5
Textbook
6
Evaluation
• Attendance: 5%
• Programming Projects: 20% (2 projects, 10% per project)
• Midterm Exam: 25%
• Final Exam: 35%
• Quiz & Assignments: 15%
7
Schedule
8
Important Dates
• Holidays
– May 6 (Tuesday): Substitute Holiday for Children's Day and
Buddha's Birthday
• Exams
– mid-term: 4/24 (Thu) 4pm – 6pm
– Final: 6/12 (Thu) 4pm – 6pm
9
Notes
• There are midterm and final projects, and both are individual
projects.
10
Python
11
Academic Integrity
• If you happen to do
– Cheating
– Plagiarism
12
Plagiarism
• All projects must be done individually:
– You may not copy code directly from any other source
– Plagiarism detection software will be used on all of the projects
– If you viewed another code (from books or lecture notes), you must
include a reference in your project
• Leave a comment!
– You should not share code with any other students by transmitting
completed functions to your peers
• This restriction includes—but is not limited to—electronic and hard-copy
sharing
• Both students (who showed or copied the code) will get the same penalty
– You may discuss projects together and help another student debug his
or her code; however, you cannot give the exact solution
13
Plagiarism
14
Motivation
Computing technology has changed, and is continuing to change the world.
Essentially every aspect of life has been impacted by computing. Computing
related fields in almost all areas of study are emerging.
15
What is Computer Science?
Computer science is fundamentally about computational problem solving.
Programming and computers are only tools in the field of computing. The field
has tremendous breadth and diversity. Areas of study include:
16
Computational Problem Solving
Two things that are needed to perform
computational problem solving:
17
e.g., Nobel Prize in Chemistry 2024
19
The Limits of
Computational Problem Solving
Once an algorithm for a given problem is developed or found, an important question is
“Can a solution to the problem be found in a reasonable amount of time?”
“But aren’t computers very fast, and getting faster all the time?”
Yes, but some problems require an amount of time to compute a solution that is
astronomical compared to the capabilities of current computing devices.
20
The Traveling Salesman Problem
The algorithm for solving this problem is a simple one. Determine the lengths of all
possible routes that can be taken, and find the shortest one – a brute force
approach. The computational issue, therefore, is for a given set of cities, how
many possible routes are there to consider?
21
If we consider a route to be a specific sequence of names of cities, then how many
permutations of that list are there?
etc.
22
Below are the number of permutations (and thus the number of routes) there are
for varies numbers of cities:
If we assume that a computer could compute the routes of one million cities per
second:
• for fifty cities, it would take longer than the age of the universe!
23
Computer Algorithms
An algorithm is a finite number of clearly
described, unambiguous “doable” steps
that can be systematically followed to
produce a desired result for given input in
a finite amount of time (that is, it
eventually terminates).
24
Computer Hardware
Computer hardware comprises the physical part of a computer system.
It includes the all-important components of the central processing unit
(CPU) and main memory. It also includes peripheral components such as
a keyboard, monitor, mouse, and printer.
25
Fundamental Hardware Components
Central processing unit (CPU) – the “brain” of a computer system.
Interprets and executes instructions.
26
27
Digital Computing: Its all About Switches
28
Operating Systems
29
Operating systems also provide a particular user interface.
30
31
Computer Software
32
Program Debugging:
Syntax Errors vs. Semantic Errors
Syntax errors are caused by invalid syntax (for example, entering prnt
instead of print).
33
In contrast, semantic errors (generally called logic errors ) are errors in
program logic. Such errors cannot be automatically detected, since
translators cannot understand the intent of a given computation.
Therefore, programs are not terminated when containing logic errors,
but give incorrect results.
The term program “bug” (and “debugging”) has become a standard part of the
language of computer programmers. The log book, complete with the attached bug, is
on display at the Smithsonian Institution in Washington, D.C.
35
The Process of
Computational Problem Solving
Computational problem solving does not simply involve the
act of computer programming. It is a process, with
programming only one of the steps.
36
Computational Problem Solving Steps
37
The Python Programming
Language
The Python Programming Language was
created by Guido van Rossum. It was first
released in the early 1990s.
38
Python Philosophy
• Guido’s philosophy on programming language
ü “Python is an experiment in how much freedom programmers need. Too
much freedom and nobody can read another’s code; too little and
expressiveness is endangered.”
39
Python Features
• Simple Syntax
Python programs are clear and easy to read
• Interpreted Language
Python instructions can be executed interactively
40
Release History
• First release
• Python 0.9.0 (Feb. 1991)
• Python 1.0 (Feb. 1994)
• Up to Python 1.6
• Python 2.0 (Oct. 2000)
• Up to Python 2.7
• Python 3.0 (Dec. 2008)
• Broke backward compatibility
• Current version is Python 3.13 (released in Oct. 2024)
https://www.python.org/
41
The Python Shell
Python can be executed interactively in the Python shell. In this mode,
executing Python is similar to using a calculator.
The >>> symbol is the shell prompt. Here, typing 2 + 3 at the prompt
outputs the result 5, redisplaying the prompt in wait of another instruction.
42
The Python Standard Library
The Python Standard Library is a collection of built-in modules, each
providing specific functionality beyond what is included in the “core” part
of Python.
43
Importing a Library Module
44
Because the factorial function is from the math module, the function is
called with the name of the module prepended:
e.g., math.factorial(20)
45
A Bit of Python
We introduce a bit of Python, just enough to begin writing some simple
programs.
• input data
• process the data
• output results
46
Variables
One of the most fundamental concepts in programming is that of a
variable.
n + 20 (5 + 20) à 25
48
Basic Input
The programs that we will write request and get information from the user.
In Python, the input function is used for this purpose,
Characters within quotes are called strings. This particular use of a string, for
requesting input from the user, is called a prompt.
The input function displays the string on the screen to prompt the user for
input,
49
Basic Output
The print function is used to display information on the screen in Python.
This may be used to display a message (string),
>>> print('Welcome to My First Program!')
Welcome to My First Program!
50
Can also display a combination of strings and variables,
>>> name = input('What is your name?: ')
What is your name?: Charles
Note that a comma is used to separate the individual items being printed,
which causes a space to appear between each when displayed. Thus, the
output of the print function in this case is
Hello Charles
and not
HelloCharles
51
The IDLE Python
Development Environment (1/2)
IDLE is an integrated development environment (IDE). An IDE is a bundled
set of software tools for program development. This typically includes,
• an editor
for creating and modifying programs
• a translator
for executing programs, and
• a program debugger
for taking control of the execution of a program to aid in finding
program errors
52
The IDLE Python
Development Environment (2/2)
53
Using IDLE
In order to become familiar with writing your own Python programs using
IDLE, we will create a simple program that asks the user for their name, and
then responds with a greeting.
54
Creating a New Python Program
To create a Python program file, select New File from the File menu in the VS
Code,
55
Now can begin entering lines of a program without them being immediately
executed, as in the Python shell.
• Note that parts of the program lines are displayed in a certain color. Since print
and input are predefined function names in Python, they are colored purple. The
strings in the program are colored green. The statement in red is a comment
statement. Comment statements are for those reading the program, and are
ignored when the program is executed.
• When finished, save the program file by selecting Save As (under the File menu)
and save in the appropriate folder with the name MyFirstProgram.py.
56
Executing a Python Program
To run a Python program, select Run Without Debugging from the Run menu
57
If you have entered the program code correctly, the program should execute
as shown
However, if you have mistyped part of the program resulting in a syntax error
(such as mistyping print), you will get an error message.
58
In such instances, you need to go back to the program window and make the
needed corrections, the re-save and re-execute the program. You may need
to go through this process a number of times until all the syntax errors have
been corrected.
59