Learn Coding - Lesson 2 - English
Learn Coding - Lesson 2 - English
Lesson 2
Python language
Goals
● Use Cases of python .
● Writing first program using python .
● Dealing with python’s syntax .
● Comments .
● Variables .
● Datatypes .
● Casting .
Goals
● Booleans .
● Arithmetic
● Input .
● Assignment operations .
● Logic operations .
● If else statement .
Python
It is a well-known programming language that was
invented by Guido van Rossum in 1991
Python
Use cases of python
● Web development (server side) .
● software development .
● Data analysis , big data , machine learning , AI .
● Mathematics .
● Scripting …
Python
Why python ?
● Supports in various systems (windows, linux, mac os, raspberry pi ..).
● Simple syntax close to english .
● Allows to write program with less code .
● Object oriented programming language .
● Big number of libraries and open source projects .
● Used by large number of programmers around the world
● Highly demanded in job market .
Python
Writing programs using python
Printing in the screen
Launch vs code
Camel case
Pascal case
Snake case
Assign value to variables
Printing in the output
You can know the type of any variable in any time using the
function type(variable)
أﻧﻮاع اﻟﺒﻴﺎﻧﺎت
Data types
Casting
Python automatically assigns the data type to a
variable without having to specify it in the code
casting اﻟﺘﺤﻮﻳﻞ
What is casting ?
casting اﻟﺘﺤﻮﻳﻞ
Casting to integers ( natural numbers )
Casting to real numbers (float)
Casting to string
Boolean
What is a boolean ?
Boolean
Boolean
Arithmetic
Mathematic operations
Example Meaning The operation
x+y Addition +
x-y Substraction -
x*y Multiplication *
x/y Division /
x%y The rest of the %
division
x**y Power **
x//y Natural division //
Arithmetic operations
Remark
+
Addition in strings means putting the
texts together and it’s called
concatenation
concatenation
Concatenation
Data input
How to input data from the user ?
Input
Input
x or y or or
Logic operations
If conditions
Different conditions cases
Operation Meaning Example
== equal a == b
!= not equal a != b
< less a<b
> greater a>b
>= greater or equal a>=b
<= less or equal a<=b
Conditions
if , else condition
Conditions
if conditions اﻟﺤﺎﻻت واﻟﴩوط
elif
elif It is used in the case of adding another test
after a previous test that was tried
Wrong syntax
ﺷﻜﺮا