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



Download 2,02 Mb.
Pdf ko'rish
bet32/126
Sana01.01.2022
Hajmi2,02 Mb.
#285662
1   ...   28   29   30   31   32   33   34   35   ...   126
Bog'liq
Learning Python The Ultimate Guide for Beginners to Coding with

Numbers in Python
Numbers are used in programming to store information, represent data, and keep scores, etc., In
Python,  numbers  are  treated  in  several  ways,  depending  on  what  they  are  used  for.  In  this
section, we will look at how Python supports various numerical types, such as integer, float, and
complex numbers. Integers are easier to work with when writing programs.
Integers
You  can  perform  operations  such  as  addition,  subtraction,  multiplication,  and  division  on
integers.  In  the  later  chapter,  we  will  explore  more  on  these  operators.  I  just  want  you  to  be
familiar with them. For instance:


>>> 3+8
>>> 8 -7
>>>8*2
>>>8/4
If you want to use an exponent, then you have to use two multiplication symbol.
>>5**2
>> 12**5
Python  follows  the  order  of  precedence  when  performing  operation;  with  this,  you  can  use
several  operations  in  a  single  expression.  Additionally,  if  you  want  to  modify  an  order  of
operation, you can use parentheses. Python evaluates the expression in the order you specify.
>>3+2*4
>>(3 + 2) * 4
In the first expression, the output will be 11. However, for the second, it will be 20. Note that
spacing doesn’t have an effect on how expressions are evaluated in Python. Notwithstanding, it
allows you to identify the operation with the highest priority when going through the code.

Download 2,02 Mb.

Do'stlaringiz bilan baham:
1   ...   28   29   30   31   32   33   34   35   ...   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