Professional Documents
Culture Documents
Python Learning
Python Learning
---------------------------------------
round(pi)
math.ceil(pi) : rounding up
math.floot(pi) : rounding down
abs(pi) : the absolute value
pow(pi.n)
math.sqrt(144)
max(x,y,z)
min(x,y,z)
----------------------------------------
indexing[] :
name = "Hadj Ali Mohamed"
[start:stop:step]
slice() :
if statements :
if a > b:
print("higher")
elif a < b:
print("lower")
else:
print("equal")
name = ""
while len(name) == 0 :
name = input("enter your name pls: ")
--------------------------------------
for i in range(5):
print(i) #output : 0 1 2 3 4
print(i+1) #output : 1 2 3 4 5
for i in range( 5 , 10 ):
print(i) #output : 5 6 7 8 9
to fix it add 10+1
for i in "Mohamed":
print(i) # output : M o h a m e d
cool program :
import time
nested loop :
for i in range(rows):
for j in range(columns):
print(*,end="")
print() # this will auto print new line
-----------------------------------
break continue pass: