Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet19/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   15   16   17   18   19   20   21   22   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Special objects

Booleans

The two Boolean objects are True and False, and they mean much what you might expect.

Many objects can be examined to test whether they are logically false, like an empty list or

zero, or logically true, like 1.0 or a filled list. However, the True and False  objects  (note

the capital letters) are special. They are the objects that you get back when you do a truth

test. So, if you write a command to determine whether some number is equal to another

number you will get a True object if they are equal or a False object if they are not equal.

This  differs  from  some  languages  where  you  might  get  0  or  1  rather  than  dedicated

Boolean objects. Also, you can set things to be True or False within your programs where

you know that some data should only take one of two values.

hungry = True

chocolate = False

happiness = (not hungry) or (hungry and chocolate)

Performing Boolean logic operations with Python’s True and False.

None

In  Python  there  is  a  special  object  called  None.  When  you  use  this  object  it  means  that

something  is  totally  undefined.  This  is  in  contrast  to  empty  lists  or  empty  text  strings,

which still exist as container objects of their respective kind. Accordingly the None object

can be used, for example, to state that you don’t have a list at all, rather than that you have

an empty one. This distinction may seem tenuous, but it can be critical. For example, if I

have records of people where I can store the names of their children, an empty list would

indicate that a person has no children to be named, but a None object would indicate that I

have been unable to determine whether the person had any children or not; not that they

definitely had none.




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   15   16   17   18   19   20   21   22   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
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