Python Programming for Biology: Bioinformatics and Beyond


Figure 4.1.  The changes to the flow of a program’s line-by-line execution using



Download 7,75 Mb.
Pdf ko'rish
bet44/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   40   41   42   43   44   45   46   47   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Figure 4.1.  The changes to the flow of a program’s line-by-line execution using

conditionals and loops. The normal flow of a program’s execution proceeds from one

line to the next. The presence of a conditional test, using an ‘if’ statement, means a block

of code is only executed if the test evaluates to be logically true, and otherwise the block

is skipped. The presence of a loop, starting with a ‘for’ or ‘while’ statement, causes the

execution of a block of code to be repeated a number of times from the start of the block

and after the last repeat the program execution resumes after the block.

Loops,  conditional  statements  and  functions  are  the  three  ways  of  controlling  a



program’s  flow  that  occur  under  ordinary  circumstances.  There  is  actually  a  fourth  way

that can cause a jump in program execution and that is if an error or exception occurs, i.e.

something  illegal  has  happened.  In  Python,  like  with  Java  and  many  other  languages,

when an error occurs inside a function, the exception propagates back up the stack of any

function  calls,  until  it  finds  the  first  of  those  functions.  If  the  initial  function  does  not

specifically  handle  the  error,  then  the  program  (or  more  precisely  that  specific  thread)

stops.

Code blocks

With all of the means by which Python code execution can jump about we naturally need

to be aware of the boundaries of the block of code we jump into, so that it is clear at what

point the job is done, and program execution can jump back again. In essence it is required

that the end of a function, loop or conditional statement be defined, so that we know the

bounds of their respective code blocks.





Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   40   41   42   43   44   45   46   47   ...   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