Algorithms For Dummies


TABLE 4-2 Python Arithmetic Operators



Download 7,18 Mb.
Pdf ko'rish
bet151/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   147   148   149   150   151   152   153   154   ...   651
Bog'liq
Algorithms

TABLE 4-2

Python Arithmetic Operators

Operator


Description

Example


+

Adds two values together

5 + 2 = 7

-

Subtracts the right operand from the left operand



5 – 2 = 3

*

Multiplies the right operand by the left operand



5 * 2 = 10

/

Divides the left operand by the right operand



5 / 2 = 2.5

%

Divides the left operand by the right operand and returns the remainder



5 % 2 = 1

**

Calculates the exponential value of the right operand by the left operand



5 ** 2 = 25

//

Performs integer division, in which the left operand is divided by the right 



operand and only the whole number is returned (also called floor division)

5 // 2 = 2




CHAPTER 4

  Introducing Python for Algorithm Programming 

     71


Sometimes you need to interact with just one variable. Python supports a number 

of unary operators, those that work with just one variable, as shown in Table 4-3.

Computers can perform other sorts of math tasks because of the way in which the 

processor works. It’s important to remember that computers store data as a series 

of individual bits. Python lets you access these individual bits by using bitwise 

operators, as shown in Table 4-4.


Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   147   148   149   150   151   152   153   154   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish