0% found this document useful (0 votes)
16 views56 pages

CSE111 Lecture1 F

The document outlines the CSE-111 Introduction to Computer Science course, taught by Dr. Ehab Elshazly in Spring 2025, detailing the instructor's background, course expectations, grading scheme, and attendance policy. It emphasizes the importance of logical thinking, programming skills, and the study of algorithms, while providing an overview of computer science as a discipline focused on computation and problem-solving. Additionally, it introduces Python as the primary programming language for the course and includes instructions for setting up the programming environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views56 pages

CSE111 Lecture1 F

The document outlines the CSE-111 Introduction to Computer Science course, taught by Dr. Ehab Elshazly in Spring 2025, detailing the instructor's background, course expectations, grading scheme, and attendance policy. It emphasizes the importance of logical thinking, programming skills, and the study of algorithms, while providing an overview of computer science as a discipline focused on computation and problem-solving. Additionally, it introduces Python as the primary programming language for the course and includes instructions for setting up the programming environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Department of Computer Science & Engineering

CSE-111 Introduction to Computer Science


Instructor: Dr. Ehab Elshazly
Spring 2025
• Who am I?

• What is my expectations from you?


Permenant Job at Visiting research Postdoctoral
EAEA, Assistant student at Kyushu research fellow at
Professor University, Japan Kyushu University
December 2006 April 2015 to January
(Demonstrator) till now July 2022-January 2023
2016
(Assistant Professor)

Postdoctoral research ICT department


BSc. & MSc. fellow at Shenzhen
Menoufya University PhD EJUST head at NCTU
University, China
2004-2012 2013-2016 Batch 7 March 2018-March October 2023 till now.
2020
What I expect from you …
Work hard!

Do a fair amount of programming

Attend the lectures

Interact in class: ask and answer questions, take notes if necessary

Activate logical thinking skils

Complete HW & Programming Assignments independently

Plan your time ahead!

Start from day 1


Don’t wait to the last minute for submissions
CSE 111
Level Under-Graduate
Pre-requisites None
Attendance Policy A minimum of 75% attendance is expected all over the course.
Attention:

Instructor contact [email protected]


B7 F0 G35
Grading Scheme This part will be covered with 50 marks in final exam out of 80.
Two quizes or one quiz and one assignment will be scheduled during the rest
of the semister costs 30 mark

General Rule No excuses


No Bonus
Google classroom QR code

Class code
gx5dipq2

Google classroom: https://classroom.google.com/c/NzcyODAxMTI1OTc5?cjc=gx5dipq2


CSE 211/212 –Computer Programming
Introduction to basic programming concepts; basic syntax and semantics of a
Course Overview
modern high level language; variables; data types; assignment, arithmetic and
logic operations.

ü Students demonstrate basic programming language skills including familiarity


Expected Outcome
with data types, variables, conditional statements, loops, and file handling.

ü Students demonstrate ability to use python to solve simple computational


problems.
CSE 211/212 –Computer Programming
1. Python Programming: An Introduction to Computer Science, John Zelle
Recommended
References 2. Introduction to Programming Using Python 3, Daniel Liang.

3. Introduction to Computer Science Using Python: A Computational Problem-


Solving Focus, Charles Dierbach

4.Think Python,2nd Edition

5. Introduction to Computation and Programming Using Python, Second


Edition, John V. Guttag
Disclaimer Slides throughout the course are based on the textbooks above and some
slides will be modified from the slides made available by the above
mentioned textbook publishers & authors.

Copyright © 2016 Elsevier


• Select one or more of the reference textbooks and read
relevant topics after each lecture

• Come to every lecture.

• Practice writing a lot of programs.


– Work independently
– Turn in assignments on time.
• Foundation Comes First

• There is no such thing as “Gifted Programmer”, You need to


work hard.
Lecture One : Introduction
• It is not the study of computers!
“Computers are to computer science what telescopes are to
astronomy.” –
E. Dijkstra
• The question becomes, “What processes can be described?”
• This question is really, “What can be computed?”
• Some one may think computer science is just about learning
technology.

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

• computer science is the study of computation (more than just machinery)


– it involves all aspects of problem solving, including
• the design and analysis of algorithms
• the formalization of algorithms as programs
• the development of computational devices for executing programs
• the theoretical study of the power and limitations of computing
14
• A modern computer can be defined as “a machine that stores
and manipulates information under the control of a changeable
program.”
• Two key elements:
– Computers are devices for manipulating information.
– Computers operate under the control of a changeable program.

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)

· Provides several essential services:


– Loading & running application programs
– Allocating memory & processor time
– Providing input & output facilities
– Managing files of information
A Layered View of the Computer

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

Ø Accessing computer resources is divided into layers.


Ø Each layer is isolated and only interacts directly with the layer below or
above it.
Ø If we install a new hardware device
ü No need to change anything about the user/applications.
ü However, you do need to make changes to the operating system.
ü You need to install the device drivers that the operating system will
use to control the new device.
Ø If we install a new software application
ü No need to make any changes to your hardware.
ü But we need to make sure the application is supported by the operating
system
ü user will need to learn how to use the new application.
Ø If we change the operating system
ü Need to make sure that both applications and hardware will
compatible with the new operating system.
Programs

• Programs are written in programming languages


– PL = programming language
– Pieces of the same program can be written in different PLs
A PL is
– A special purpose and limited language
– A set of rules and symbols used to construct a computer
program
– A language used to interact with the computer
Programming is the process of writing instructions that a computer can follow to
perform specific tasks.
It's like giving a recipe to a computer.
Programs are written in programming languages like Python, Java, or C++.
Used to create software, websites, mobile apps, games, etc.

Why Learn Programming?


Automate tasks
Solve problems efficiently
Build real-world applications
Think like a computer scientist
Computing jobs are the #1 source of new wages in the United States

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?

- Logical thinking is the process of reasoning consistently to


reach a conclusion.

- In computing:

• Break problems into steps

• Follow rules and sequences

• Use patterns and reasoning

- Think like a detective solving a mystery!


Logical Thinking Concepts
Algorithm
An algorithm is a step-by-step procedure or a set of rules to solve a specific problem or
perform a task.
Think of it as a recipe — it tells you what to do, but not how it's implemented in code.

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).

• The word “algorithm” is derived from the


ninth-century Arab mathematician, Al-
Khwarizmi who worked on “written
processes to achieve some goal.”

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:

1. Natural Language (Plain English)


Describes the steps in simple words.

Easy to understand, but can be vague or ambiguous.

Example:

Step 1: Start with the first number.


Step 2: Compare it with the next one.
Step 3: Keep the larger number.
Step 4: Repeat until the end.
2. Pseudocode
Looks like code but is not tied to a specific programming language.

More precise than natural language, yet still easy to read.


3. Flowcharts
Uses diagrams with shapes (arrows, diamonds, etc.) to represent the flow of the algorithm.
Great for visual learners.
Example Elements:

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?

• A programming language is a notational system for describing


computation in machine-readable and human-readable form.
• Most of these forms are high-level languages, which is the subject of
the course.
• Assembly languages and other languages that are designed to more
closely resemble the computer’s instruction set than anything that is
human-readable are low-level languages.
• Add two numbers:
– Load the number from memory location 2001 into the CPU
– Load the number from memory location 2002 into the CPU
– Add the two numbers in the CPU
– Store the result into location 2003
• In reality, these low-level instructions are represented in binary
(1’s and 0’s)

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.

– Evolution -- we've learned better ways of doing things over time

– Socio-economic factors: proprietary interests, commercial advantage

– 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

A hybrid implementation system for a programming language combines aspects of both


interpretation and compilation. The goal of such systems is to take advantage of the
strengths of both approaches—interpretation’s flexibility and dynamic behavior, and
compilation’s speed and efficiency.
• High-level language
c=a+b
• This needs to be translated into machine language that the
computer can execute.
• Compilers convert programs written in a high-level language
into the machine language of some computer.

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

– Compiled programs generally run faster since the translation of the


source code happens only once.

45
Python Programming, 3/e
– Interpreted languages are part of a more flexible programming
environment since they can be developed and run interactively

– Interpreted programs are more portable, meaning the executable code


produced from a compiler for a Pentium won’t run on a Mac, without
recompiling. If a suitable interpreter already exists, the interpreted code
can be run with no modifications.

46
Python Programming, 3/e
What is Python?

Python is a:

High-level programming language (easy to read and write)

General-purpose (used in web, data science, AI, automation, games, etc.)

Beginner-friendly (simple syntax, like English)

Very popular (huge community and tons of free resources)


• The Python Programming Language was created by
Guido van Rossum. It was first released in the early
1990s.

• Its name comes from a 1970s British comedy sketch


show called Monty Python’s Flying Circus. (An example
of their work is The Argument Clinic).

• Companies and organizations that use Python include


YouTube, Google, Yahoo and NASA.

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

Click “Downloads” → it usually auto-detects your OS (Windows/macOS/Linux).

Download and run the installer.

❗ 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

• Vocabulary / Words - Variables and Reserved words (Chapter 2)

• Sentence structure - valid syntax patterns (Chapters 3-5)

• Story structure - constructing a program for a purpose


Reserved Words

• You can not use reserved words as variable names / identifiers

and del for is raise assert elif from lambda


return break else global not try class except
if or while continue exec import
pass yield def finally in print
Statements

x=2 Assignment Statement


x=x+2 Assignment with expression
print x Print statement
Python Scripts

• 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.

• In a sense we are “giving Python a script”

• As convention, we add “.py” as the suffix on the end of these files to


indicate they contain Python
Interactive vs. Script

• Interactive

- You type directly to Python one line at a time and it responds

• 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

You might also like