Lecture 1 (1)
Lecture 1 (1)
Lectures Notes
For 1St year, Civil Engineering, Faculty of Engineering, Al-Azhar University
By, Dr. Eid F. Latif, PhD, Public Work Departement
What is programming?
Programming refers to a technological process for telling a computer which
tasks to perform in order to solve problems. You can think of programming as a
collaboration between humans and computers, in which humans create
instructions for a computer to follow (code) in a language computers can
understand.
How does computer programming work?
At its most basic, programming tells a computer what to do. First, a
programmer writes code—a set of letters, numbers, and other characters. Next,
a compiler converts each line of code into a language a computer can
understand. Then, the computer scans the code and executes it, thereby
performing a task or series of tasks. Tasks might include displaying an image
on a webpage or changing the font of a section of text.
Machine language is the language understood by a computer. It is very difficult
to understand, but it is the only thing that the computer can work with. All
programs and programming languages eventually generate or run programs in
machine language.
, Python
Most used programming's languages among developers
worldwide as of 2023
What you can do with these programming languages?
JavaScript
This language is used on every major web browser. JavaScript allows you
to add complex features to a web page, such as content updates, interactive
maps, and animated graphics, develop games, and more.
HTML/CSS
These languages are used to create web pages and web applications. You
would use HTML (HyperText Markup Language) to build web page
structure, while CSS (Cascading Style Sheets) would enable you to
determine the page’s styling.
Python
Python programming is most used in machine learning, web development,
and desktop applications. Python is a popular language among beginners,
as the syntax is relatively easy to learn. It is known as an object-oriented
programming language.
What is Python?
● Python is a popular high-level programming
language used in various applications
○ Python is an easy language to learn because of its
simple syntax
○ Python can be used for simple tasks such as plotting or
for more complex tasks like machine learning
Common Data Types and Operators
● A data type is a means of classifying a value and determining what
operations can be performed on it. All objects have a data type.
● Operators are symbols used carry out specific functions/computations.
{“1”:”ahmed”, “country”:”Egypt” }
Basic Syntax Rules
● The name of your variable (myInt etc.) is placed on the left of the “=“ operator.
○ Most variable names are in camel case where the first word begins with a lowercase
letter and any subsequent words are capitalized
○ Variable names may also appear in snake case where all words are lowercase, with
underscores between words
● The assignment operator (“=“) sets the variable name equal to the memory location where
your value is found.
● The value of your variable (“Hello, World”) is placed on the right of the “=“ operator.
○ The type of this value does NOT need to be stated but its format must abide by a given
object type (as shown).
+ Addition 9+2 is 11
9.1+2.0 is 11.1
- Subtraction 9-2 is 7
9.1-2.0 is 7.1
* Multiplication 9*2 is 18
9.1*2.0 is 18.2
/ Division 9/2 is 4.25 In Python3
9.1/2.0 is 4.55 Real div.
// Integer Division 9//2 is 4
% Remainder 9%2 is 1
The Programming Cycle for Python
Run
with some input
Write/Edit
OK?
NO
YES
YES
NO More
Inputs?
Which Python Version/IDE ( Integrated Development Environment) to use?
The compiler derives its name from the way it works, as looking at the entire piece of
source code and collecting and reorganizing the instructions. It translates high-level
instructions directly into machine language. Compiled programs generally run faster.
The machine code which typically stored in a file is also referred as binary code and
can be directly executed by the machine after linking. Examples of compiled
programming languages are C, C++, C#, Objective-C, SWIFT, and Fortran.
https://www.youtube.com/watch?v=SMyzYOP
GeD8&list=PLuXY3ddo_8nzrO74UeZQVZOb5
-wIS6krJ&index=4
https://www.youtube.com/watch?v=WTRKeSo
ynKI&list=PLuXY3ddo_8nzrO74UeZQVZOb5-
wIS6krJ&index=3
Editor area