Numbers in Python (int, float, //, **)
Në shqip: Numrat në Python
ShpjegimiSQ
Python-i ka int për numra të plotë (pa kufi madhësie!) dhe float për numra me presje. / jep gjithmonë float, // pjesëtim të plotë, % mbetjen dhe ** fuqinë.
EnglishEN
Python has int for whole numbers (with no size limit!) and float for decimals. / always gives a float, // does whole-number division, % gives the remainder and ** raises to a power.
Si ta mendosh
Si ta ndash 7 copë pica për 2: secili merr 3 (//), mbetet 1 (%), ose 3.5 po e prerë (/).
Lexoje në anglisht
Like sharing 7 slices of pizza between 2: each gets 3 (//), 1 is left (%), or 3.5 if you cut it (/).
Shembull kodipython
print(7 / 2) # 3.5
print(7 // 2) # 3
print(7 % 2) # 1
print(2 ** 10) # 1024