Programming Essentials in Python
By:
Dr Amira Ibrahim Abdelatey
[Link]@[Link]
✓ Face Mask
✓ Respect Social Distancing
2
Computer Science
• Information technology is the study of
both computer hardware and software
design. It encompasses both the study of
theoretical algorithms and the practical
problems involved in implementing them
through computer hardware and software.
3
Programming languages
• A programming language is a
formal language, which comprises a set of
instructions that produce various kinds of
output.
• Programming languages are used
in computer programming to implement
algorithms.
• Most programming languages consist of
instructions for computers. 4
Writing simple program
• Writing a program involves designing a
strategy for solving the problem and then
using a programming language to
implement that strategy.
• Writing a program involves designing
algorithms and then translating them into
programming instructions, or code
5
Algorithm
• Algorithms can be described in natural
languages or in pseudocode (natural
language mixed with some programming
code).
• The algorithm for calculating the area of a
circle can be described as follows:
– Get the circle’s radius from the user.
– Compute the area by applying the following formula:
area = radius * radius * pI 6
– Display the result.
Programming languages
• Programming languages: instructions or
computer
• It is used to implement algorithms
7
Algorithm and program
• Algorithm: steps to solve problem.
• Program: instructions or code to solve a
problem depends on algorithm.
• Programming languages: java, c++, python,
others
8
Compute Area
9
Print in python
• You can display any number of items in a
print statement using the following syntax:
print(item1, item2, ..., item k)
10
Show print result?
• width = 5.5
• height = 2
• print("area is", width * height)
11
Variables
• Variable = value or expression
• number1 = 10
• number2 = 10*2
• number3 = number1*2
12
Multiple variables
• i=j=k=1
• which is equivalent to
• k=1
• j=k
• i=j
13