Programming
In Python
Course
By Dr. Fotsing Kuetche
Fall 2025
[Link].20XX 2
[Link].20XX 3
Why This Course ?
[Link].20XX 4
1. Introduce students to the basic
concepts of computer programming.
2. Develop problem-solving and logical
thinking skills through
programming.
3. Teach students how to write, test,
and debug Python programs.
4. Provide a solid understanding of
Python syntax, control flow, and
data structures.
5. Introduce modular and object-
oriented programming principles.
6. Prepare students to apply Python in
advanced computing domains such
as software/web development, data
analysis and artificial intelligence.
[Link].20XX
5
[Link].20XX
6
What’s a Programming Language
[Link].20XX 7
We need to
communicate
To communicate =
To impart or transmit (knowledge
or information)
make known,
To tell
To share or exchange
[Link].20XX
8
We need to
communicate
Sound
(voices,
instrumen
ts…)
…… Gestures
Communicate
Pictures
Touch (Adverts,
Posters,..)
[Link].20XX
9
We need to
communicate
Sound
(voices,
instru
ments…
)
Formalize
…… Gestures
Communicate
Pictures
Touch (Adverts,
Posters,..)
Language
[Link].20XX
10
We need to
communicate
Language is the ability to express
thoughts and communicate using a
system of signs (vocal, gestural, graphic,
tactile, olfactory, etc.).
[Link].20XX
11
We need to
communicate
English Language:
Forming Words = Vocabulary How to build sentences =
➢ 26 letters in the alphabet
Grammar
➢ Xxx sounds (phonetic)
➢ 10 numbers (0 to 9)
Communicate
[Link].20XX
12
communicating with Hello
computers
0011 0101
1101 1011
Computer Don’t understand English
Binary digits: 0 and 1
H e l l o
H e l l o
[Link].20XX
13
communicating with print(“Hello”)
computers
0011 0101
1101 1011
Computer Don’t understand English
Programming
Languages act as an
intermediate between
us and computers
[Link].20XX
14
What’s Programming Language?
A programming language is a set of rules for giving
instructions to a computer. It provides the syntax for giving
instructions and specifies the ways to store information, and
it controls the order in which instructions are executed in a
program.
[Link].20XX 15
Type of Programming Language
Assignment 1
The different type of programming language
[Link].20XX 16
What’s Python
[Link].20XX 17
What’s Python
Python is a programming language
created in 1989 by Guido van
Rossum, in Netherlands.
What’s Python ?
The name "Python" was
chosen because van Rossum
was a fan of the BBC TV show
"Monty Python's Flying Circus"
and wanted a name that was
short, unique, and slightly
mysterious.
What’s Python ?
❑ Python's first release was in 1991
❑ major versions like Python 2.0 released in 2000
❑ Python 3.0 in 2008
❑ Python 3.0 introduced many changes that were not backward
compatible with Python 2.x,
What’s Python ?
quickly gained popularity due to its
simplicity and readability.
[Link].20XX 22
Simple. Mutiplatform. Multiparadigm. Multi-
purpose
Simple. Mutiplatforme. Multiparadigm. Multi-
purpose
✓ High level Interpreted Language
✓ Dynamically Typed Language
Simple.
✓ Integrated Librabries
Exemple: Summing up
the elements of a matrix
Dynamically Typed
Exemple: Calcul de la
somme des éléments
d’une matrice
High level
Simple. Multiplatform. Multiparadigm. Multi-
purpose
Windows
Mac OS X
python
Multiplatform.
Linux
Android
Compatible wit several OS : a script can run on
many platforms without any modification
Simple. Mutiplatforme. Multiparadigm. Multi-
purpose
High level Compatible many OS :
Dynamically Typed Windows, Mac OS X,
Integrated Libraries Linux, Android, iOS, ….
Python support
- Imperative/procedural Programming
Multiparadigm.
- Functionnal Programming
- Object-Oriented Programming
Simple. Mutiplatforme. Multiparadigm. Multi-
purpose
Compatible with many Python support
High level OS : Windows, Mac OS X, - Procedural
Dynamically Typed Linux, Android, iOS, ….
- Functionnel
Integrated Libraries
- Object-Oriented
Various area of application:
- Software development
- Web development
Multi-
purpose - Games
- Mobile Applications
- Scientific Computing
- Artificial Intelligence Models
Simple Mutiplatforme. Multiparadigme. Muti-
purpose
Increased Productivity
Doing Much in less time
Installing Python
[Link].20XX 35
Official Distribution..
Interpreter Only Miniconda. Anaconda.
Interpreter +
Packages manager + 250+ librairies
[Link] enviroment
[Link] [Link]
A text editor is a program designed for
writing and editing code.
features to make writing and editing
code easier: syntax highlighting, for
example, colors your code so you
can quickly recognize different parts
of a program
An integrated development environment (IDE) is a text
editor with powerful project management features.
Miniconda.
Interpreter +
Packages manager +
enviroment
[Link]
A text editor is a program designed for
writing and editing code.
❑ Pyzo
❑ VSCode
❑ Jupyter
Miniconda.
Interpreter +
Packages manager +
enviroment
[Link]
Miniconda.
Interpreter +
Packages manager +
enviroment
[Link]
[Link].20XX 42
PAGE 43
PAGE 44
PAGE 45
Naming Variables
varName = varValue
• A ~ Z (uppercase or lowercase) • Boolean
Affectation
• 0~9 • Number (int, float, Complex)
• Underscore ( _ ) • String
• Always start with a letter • List
• No space • Tuple
• No keywords (if, elif, def, print, …) • Set
• dictionary
PAGE 46
Naming Variables --- impossible varName
varName = varValue
>>> import keyword
>>> [Link]
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class',
'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if',
'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while',
'with', 'yield']
PAGE 47
1. Def utilisateur1
2. enumerate
3. 1user
4. User age
5. userage
6. userAge
7. user_age
PAGE 48
Naming Variables
1. For long variable name we use
1. Snake case this_long_var
2. Camel case thisLongVar
PAGE 49
Naming Variables
1. Variable names should be short but descriptive.
For example, name is better than n,
student_name is better than s_n,
name_length is better than length_of_persons_name.
PAGE 50
MULTIPLE ASSIGNMENT: We can define multiple variables at one
go. To do that simply write
long, large, height = 10, 5, 3
long = 10
large = 5
height = 3
[Link].20XX 52
Booleans Questions:
1- are you a Cameroonian ?
2- are you at least 20 years old?
VOTE
-Cameroonian
- At least 20
Booleans
Questions:
1- are you a Cameroonian ? isCameroonian = True
2- are you at least 20 years old? isOfAge = False
Represent decision simply
the Boolean data type has only two values:
True (Yes/1) and False (No/0)
✓ Numbers : int, float, complex
Example:
x = 10
y = 10.10
z = 2 + 2j
1. By default Python uses float during operation, even if the output is an integer
(use type() )
2. For long numbers we can group using “underscore”
for example
million = 1000000000
Can be written as
million = 1_000_000_000
✓ Strings
Simple quotes name = ‘Abega’
Double quotes surname = ‘’Junior’’
For sentences, it is preferable to use Double quotes
EXAMPLE
Using simple quotes, Create a variable text1 holding the sentence :
It’s my pleasure to meet you
What’s happening?
✓ Strings error 2 The backslash
EXAMPLE 2
Create a variable myRepository with the value C:\Users\Claude
What’s happening ?
\n = new line
\t = add tabulation
\” ou \’ : quotes are no more special characters
\a = bullet point
\u, \U, \x, \N = unicode characters
✓ Strings error The backslash
EXERCISE 1: reproduce this paragraph (exactly) using just one variable
List of fruits:
• Banana
• Mango
• Lemon
text = "List of fruits: \n \t \a Banana \n \t \a Mango \n \t \a Lemon"
>>> print(text)
Assessment 2
• Write a Script to reproduce this
figure
• Use print()
[Link].20XX 59
✓ f-Strings (Formated)
>>> name = "Ibrahim"
>>> surname = "Ethan"
>>> age = 50
>>> print(f"Hello, my name is {name} {surname}, I’m {age} years old")
These strings are called f-strings. The f is for format, because Python formats the
string by replacing the name of any variable in braces with its value
✓ Strings introduction to method
A method is an action that Python can perform on a
piece of data.
[Link](<arguments>)
[Link]()
[Link]() Dot notation
✓ Type Casting
utilize
int()
float()
str()
EXERCISE
Write a Python script ([Link]) that should ask the user
to enter their last name, first name, and age, and then present
the user using "print" (the last name in UPPERCASE, the first
letter of the first name in uppercase).
OPERATORS
✓ Operators
7 operators
MATHS
addition subtraction multiplication division Floor Division modulo exponent
+ - * / // % **
Suppose x = 5, y = 2
✓ Operators
MATHS Addition: x + y = 7
Subtraction: x - y = 3
Multiplication: x*y = 10
Division: x/y = 2.5
Floor Division: x//y = 2 (rounds down the answer to the nearest
whole number)
Modulus: x%y = 1 (gives the remainder when 5 is divided by 2)
Exponent: x**y = 25 (5 to the power of 2)
✓ assignment operators
the sign =
X=0
X = X+4
✓ assignment operators
the sign =
Add and assign
X=0 +=
X = X+4
Add 4 to X and assign
equivalent X += 4 the result to X
✓ assignment operators
Similarly, if we want to do a subtraction, we can write
x = x - 2 or x -= 2.
For a multiplication: x = x*10 or x *=10
The same works for all the 7 operators mentioned previously.
✓ Operators
comparison operators
create boolean variables
equal Not equal smaller greater Smaller or equal Greater or equal
== != < > <= >=
Logical Operators
Combine Boolean expressions
and or not
isCameroonian and isOfAge
✓ Operators
ID Card:
Nationality
Questions: Age
1- are you a Cameroonian ?
2- are you at least 20 years old? Boby can vote:
If
(Nationnality == “Cameroonian”)
VOTE and
-Cameroonian (Age>=20)
- At least 20
[Link].20XX 72
Control flow statements are fundamental components of
programming languages that allow developers to control the
order in which instructions are executed in a program. They
enable execution of a block of code multiple times, execute a
block of code based on conditions, terminate or skip the
execution of certain lines of code, etc.
[Link].20XX 73
Go to Earn a
Get a job shine
school degree
1 2 3 Star
[Link].20XX 74
Go to
school
Earn a
degree
Get a job ? shine
1 2 3 Star
Yes
No
pla
net
[Link].20XX 75
Conditional Statements
Looping statements
Jump Statements
[Link].20XX 76
if/ elif/ else
match
[Link].20XX 77
✓ CONDITIONS : if, else, elif
allows the program to determine whether a certain condition is
met and to perform the appropriate action based on the result
of the evaluation
if condition1 : : (colon) indicates the
Python forces the beginning of an
indentation Action 1 instruction
elif condition 2 :
action1 executes if
condition1 is met
Action 2
else:
do E
In Python we mark the end of
the statement by a simple
space (empty line).
✓ CONDITIONS : if, else, elif
EXAMPLE: Legal Age Test
Write a Python program that takes as input:
- the surname,
- names,
- Nationality
- and year of birth of a citizen
and determines (displays) whether they are of legal age or not.
✓ CONDITIONS : if, else, elif
1. Understand the problem and its variables
The legal age is also known as the age of legal majority. This is the
age at which a person gains the legal status of an adult.
Its varies depending on the location:
▪ 21 years old in Cameroon and African countries
▪ 18 years old in USA
✓ CONDITIONS : if, else, elif
1. Understand the conditions
▪ Someone is of legal age if :
▪ He/she has 21 years old and is from Cameroon or African
countries
OR
▪ 18 years old in USA
✓ CONDITIONS : if, else, elif
Inline If
We can write a condition using a single line:
Action 1 if condition1 is True else Action 2
▪ Someone is of legal age if :
▪ He/she has 21 years old and is from Cameroon or African
countries
OR
▪ 18 years old in USA
✓ Condition : match
match variable:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case _:
return "Something's wrong with the internet"