Telegram Group & Telegram Channel
Python dasturlash maktabi
⭕️ 2-bo'lim “Operatorlar” ————————————— Ⓜ️Operatorlar guruhlari? ----------------------------- Pythonda operatorlar quyidagi guruhga bo'linadi. Arifmetik operatorlar Tayinlash operatorlari Taqqoslash operatorlari Mantiqiy operatorlar Identifikatsiya operatorlari…
Ⓜ️ Identifikatsiya operatorlari

Identifikatsiya operatorlari ma'lumotlarning xotira birligini aniqlash uchun ishlatiladi.

Xotira... Python xotirani hisobga olmaydi deyishadiku?
CPython ob'ektlari xotirani boshqarishni optimallashtirish uchun juda ko'p xotiradan foydalanadi.Bunga misol CPython -5 dan 256 gacha bo'lgan barcha butun sonlarning global ro'yxatini saqlaydi va bularning hammasi uchun 266 * 24 = 6384 baytni oldindan ajratadi.

Ma'lumotlar turi nima u?
Ma'lumotlar turiga namunalar:
str satr 'salom'
int butun sonlar 2
float haqiqiy sonlar 2.03
bool mantiqiy True yoki False

a = 28
b = 19
a va b o'zgaruvchi
28 va 19 ma'lumot
ma'lumot turi int

a va b o'zgaruvchilar ma'lumot turi bir xil lekin xotirada joylashuvi farq qilishi mumkin.
Ma'lumot xotirada joylashishini ko'rish uchun id() funktsiyasidan foydalanamiz.
>>> print(id(a))
11429120
>>> print(id(b))
11428832


is - Agar ikkala o'zgaruvchi bir xil ob'ekt bo'lsa rost (True) qaytaradi, boshqa holatda yolg'on (False) qaytaradi
print(a is b) False
print(True is False) False
print(False is False) True
print(True is True) True


is not - Agar ikkala o'zgaruvchi bir xil ob'ekt bo'lmasa rost (True) qaytaradi, boshqa holatda yolg'on (False) qaytaradi
print(a is not b) True
a = 5
b = 5
print(a is not b) False

@pythonuz



tg-me.com/pythonuz/299
Create:
Last Update:

Ⓜ️ Identifikatsiya operatorlari

Identifikatsiya operatorlari ma'lumotlarning xotira birligini aniqlash uchun ishlatiladi.

Xotira... Python xotirani hisobga olmaydi deyishadiku?
CPython ob'ektlari xotirani boshqarishni optimallashtirish uchun juda ko'p xotiradan foydalanadi.Bunga misol CPython -5 dan 256 gacha bo'lgan barcha butun sonlarning global ro'yxatini saqlaydi va bularning hammasi uchun 266 * 24 = 6384 baytni oldindan ajratadi.

Ma'lumotlar turi nima u?
Ma'lumotlar turiga namunalar:
str satr 'salom'
int butun sonlar 2
float haqiqiy sonlar 2.03
bool mantiqiy True yoki False

a = 28
b = 19
a va b o'zgaruvchi
28 va 19 ma'lumot
ma'lumot turi int

a va b o'zgaruvchilar ma'lumot turi bir xil lekin xotirada joylashuvi farq qilishi mumkin.
Ma'lumot xotirada joylashishini ko'rish uchun id() funktsiyasidan foydalanamiz.

>>> print(id(a))
11429120
>>> print(id(b))
11428832


is - Agar ikkala o'zgaruvchi bir xil ob'ekt bo'lsa rost (True) qaytaradi, boshqa holatda yolg'on (False) qaytaradi
print(a is b) False
print(True is False) False
print(False is False) True
print(True is True) True


is not - Agar ikkala o'zgaruvchi bir xil ob'ekt bo'lmasa rost (True) qaytaradi, boshqa holatda yolg'on (False) qaytaradi
print(a is not b) True
a = 5
b = 5
print(a is not b) False

@pythonuz

BY Python dasturlash maktabi


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/pythonuz/299

View MORE
Open in Telegram


Python dasturlash maktabi Telegram | DID YOU KNOW?

Date: |

For some time, Mr. Durov and a few dozen staffers had no fixed headquarters, but rather traveled the world, setting up shop in one city after another, he told the Journal in 2016. The company now has its operational base in Dubai, though it says it doesn’t keep servers there.Mr. Durov maintains a yearslong friendship from his VK days with actor and tech investor Jared Leto, with whom he shares an ascetic lifestyle that eschews meat and alcohol.

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

Python dasturlash maktabi from id


Telegram Python dasturlash maktabi
FROM USA