Learning Python: The Ultimate Guide for Beginners to Coding with Python with Useful Tools



Download 2,02 Mb.
Pdf ko'rish
bet80/126
Sana01.01.2022
Hajmi2,02 Mb.
#285662
1   ...   76   77   78   79   80   81   82   83   ...   126
Bog'liq
Learning Python The Ultimate Guide for Beginners to Coding with

Numerical Comparison in Python
We can also test numerical values in Python, but it is very straightforward.
For instance, the code below determines if a person’s age is 25 years old:
>>>myage = 25
>>>myage == 25
True


Additionally,  we  can  also  test  if  two  numbers  are  unequal.  Consider  the
code below.
number = 34
if number != 54:
print(“The number does not match. Please retry!”)
The first line declares number as a variable and stores the number “34” in it.
The  conditional  statement  begins  in  line  two  and  passes  through  the  line
because the number 34 is not equal to 54. Since the code is indented, the
code is then executed to produce
The number does not match. Please retry!
Besides this, you can perform various mathematical comparison inside your
conditional expressions including greater than, greater than or equal to , less
than, and less than or equal to.
>>> number = 22
>>> number <25
True
>>> number <= 25
True
>>> number > 25
False
>>> number >= 25
False
Every mathematical comparison you want can be included as part of an “if
statement” that allows you to detect the particular condition in question.



Download 2,02 Mb.

Do'stlaringiz bilan baham:
1   ...   76   77   78   79   80   81   82   83   ...   126




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