You are on page 1of 2

Python

Mathematics:

It is used as a calculator (+,-, *, /)

**: ‫االس‬

“Print” function and string:

Print ("any sentence here called string "):


Always use parentheses, quotation marks single or double and then run

Variables

Name of the variable either letter or word = 2

X, Y = (2, 4) may be 2 variable at the same line or syntax

X= print function can be used here

Function:

Def name of the function (parameters e.g. num 1, num2 =5 or Height, width, font type):
column

Print (“ ”)

X= 2/2

Print(x)

Example (3, 6) then run

Loops:

For loop and While loop:

For loop:

Pretty much the same and they do the same tasks, so it depends on your
preferences
(1) Example list = [2, 4, 9,757, 99, 45, 38, 6, 0]

For x in example list:

Print(x) run, it will give 2, 4, 9,757, 99, 45, 38, 6, 0

(2) For x in range (1, 11):

Print(x) , run then it will gives from 1 to 10 not 11

While loop: not equal if

(1) Condition=1

While condition<10:

Print (condition)

Condition +=1 , run, it should give from 1 to 9

(2) While true:

Print ('doing stuff'), run, it will give doing stuff too much infinitely

If statement:

You might also like