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



Download 2,02 Mb.
Pdf ko'rish
bet28/126
Sana01.01.2022
Hajmi2,02 Mb.
#285662
1   ...   24   25   26   27   28   29   30   31   ...   126
Bog'liq
Learning Python The Ultimate Guide for Beginners to Coding with

Comparison Operators
From  the  name,  you  can  easily  understand  what  these  operators  are  used  for.  They  compare
values on both side of an operand and determine the relationship between them. At times, they
are known as relational operators. These operators include <>, <=, >=, !=, == etc. They compare
values  and  return  the  results  in  true  or  false.  let  us  rewrite  our  previous  arithmetical  operator
example.
number1 = 6
number2 = 3
print(“number1 > number2”, number1 >number2)
print(“number1 < number2”, number1 print(“number1 != number2”, number1 !=number2)
print(“number1 >= number2”, number1 >= number2)
print(“number1 <= number2”, number1 <= number2)
Output
True
False
True
True
False
Assignment Operators


The primary function of these operators is to assign a value to a variable. You assign what is on
the left-hand side to the right. These operators include +=, *=, -=, /=, etc.
number1 = 6
number2 = 3
print(("The value of number1 is : ", number1))
print(("The value of number2 is : ", number2))
6
3
There  are  also  compound  assignment  operators  where  you  can  subtract,  add,  multiply  a  right
operand to the left before assigning it to the left. In the next program, we will add the value of
number1 and number 2 before assigning the results to another variable and print out the output.
number1 = 6
number2 = 3
result = number1 + number2
print((“ The result of number1 and number2 is:”, result))
In the program above, we just perform a simple assignment. Our output will be 9.

Download 2,02 Mb.

Do'stlaringiz bilan baham:
1   ...   24   25   26   27   28   29   30   31   ...   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