CSE111 Lecture1 F
CSE111 Lecture1 F
Class code
gx5dipq2
12
Python Programming, 3/e
• Computer science is just
• about learning technology
• Computer science is about logic, problem
solving, and creativity
• some people argue that computer science is not a science in the same sense that
biology and chemistry are
– the interdisciplinary nature of computer science has made it hard to classify
15
Python Programming, 3/e
• What is a computer program?
– A detailed, step-by-step set of instructions telling a computer what to
do.
– If we change the program, the computer performs a different set of
actions or a different task.
– The machine stays the same, but the program changes!
16
Python Programming, 3/e
Software Categories
• System SW
– Programs written for computer systems
• Compilers, operating systems, …
• Application SW
– Programs written for computer users
• Word-processors, spreadsheets, & other
application packages
Operating System (OS)
Application Programs
Word-Processors, Spreadsheets,
Database Software, IDEs,
etc…
System Software
Compilers, Interpreters,Preprocessors, etc.
Operating System, Device Drivers
Machine with all its hardware
The Structure of Computer Systems
5 0 0 , 0 0 0
c u r r e n t
openings:
These jobs are
i n e v e r y
industry and
every state, and
they’re projected
to grow at twice
the rate of all
other jobs.
logical thinking is the foundation of programming.
Programming requires you to:
Analyze problems clearly
Break them down into smaller steps
Use conditions, loops, and functions effectively
Understand cause and effect (e.g., if this happens, then do that)
All of this depends on clear, structured, logical reasoning. Without logical thinking, it's
hard to write code that works correctly, handles edge cases, and is easy to debug and
improve.
What is Logical Thinking?
- In computing:
Example:
An algorithm to find the maximum number in a list:
Start with the first number as the maximum.
Compare it with the next number.
If the next number is larger, update the maximum.
Repeat until the end of the list.
Output the maximum.
• 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 f i n i te a m o u nt o f t i m e ( t h a t i s , i t
eventually terminates).
Introduction to Computer Science Using Python – Dierbach Copyright 2013 John Wiley and Sons Section 1.2 Computer Algorithms 28
Key Characteristics of an Algorithm
1. Finiteness
The algorithm must always terminate after a finite number of steps.
It cannot run forever.
This ensures the solution is reachable.
2. Input / Output
Input: An algorithm may receive zero or more inputs to start with.
Output: It must produce at least one output, which is the result of the process.
3. Definiteness
Each step of the algorithm must be clearly and precisely defined.
No ambiguity in what needs to be done.
Ways to Express Algorithms:
Example:
Decision (if/else)
Process (calculation)
Flow (arrows)
4. Programming Languages
The most formal and executable way.
The algorithm is translated into real code that a
computer can run.
Computer Program
A computer program is a written
implementation of an algorithm using a
programming language (like Python, C++, Java,
etc.).
It can be executed by a computer.
What is a Programming Language?
35
Python Programming, 3/e
Why Study Programming Languages?
• In 1969, Sammet listed 120 programming languages in common use – now there are many more!
• Most programmers never use more than a few.
– Some limit their career’s to just one or two.
– Orientation towards special purposes SQL for database queries, MATLAB for numerical
computing and VHDL/Verilog for hardware description.
– Orientation towards special hardware: CUDA for NVIDIA GPUs and Rust and Go for systems-
level and concurrent programming, often close to the metal.
• The TIOBE Programming Community index is an indicator of the
popularity of programming languages.
• The index is updated once a month. The ratings are based on the number
of skilled engineers world-wide, courses and third party vendors.
• Popular web sites Google, Amazon, Wikipedia, Bing and more than 20
others are used to calculate the ratings.
• It is important to note that the TIOBE index is not about the best
programming language or the language in which most lines of code
have been written.
• The index can be used to check whether your programming skills are
still up to date or to make a strategic decision about what programming
language should be adopted when starting to build a new software
system.
Implementation Methods
• Compilation
• Pure Interpretation
• Hybrid Implementation Systems
41
Python Programming, 3/e
42
Python Programming, 3/e
• Interpreters simulate a computer that understands a high-level
language.
• The source program is not translated into machine language all
at once.
• An interpreter analyzes and executes the source code
instruction by instruction.
43
Python Programming, 3/e
44
Python Programming, 3/e
• Compiling vs. Interpreting
– Once program is compiled, it can be executed over and over without
the source code or compiler. If it is interpreted, the source code and
interpreter are needed each time the program runs
45
Python Programming, 3/e
– Interpreted languages are part of a more flexible programming
environment since they can be developed and run interactively
46
Python Programming, 3/e
What is Python?
Python is a:
Introduction to Computer Science Using Python – Dierbach Copyright 2013 John Wiley and Sons Section 1.2 Computer Algorithms 49
How to Set Up Python and an Editor on Your PC
✅ Step 1: Install Python
Go to the official website: https://www.python.org
❗ Important: During installation, check the box that says “Add Python to PATH”
before clicking Install.
https://www.online-python.com/
When you start Python, you will see something
like:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
51
Python Programming, 3/e
Elements of Python
• Interactive Python is good for experiments and programs of 3-4 lines long
• But most programs are much longer so we type them into a file and tell
python to run the commands in the file.
• Interactive
• Script
- You enter a sequence of statements (lines) into a file using a text editor
and tell Python to execute the statements in the file