Telegram Group & Telegram Channel
Python dasturlash maktabi
Ⓜ️ To'plam. To'plam - takrorlanmaydigan va tartiblanmagan ma'lumotlar saqlaydigan ma'lumot turi. To'plamdan takrorlanmaydigan ma'lumotlarni saqlash uchun foydalaniladi. toplam = {'pythonuz', 'pythonuz', 1, 2, 1, 1} print(toplam) {'pythonuz', 2, 1} Jingalak…
Ⓜ️ To'plam funksiyalari va uslublari

t1 = {1, 2, 3, 'a', 'b'}
t2 = {7, 8, 9, 'w', 'z'}
t3 = {'a', 'b'}

To'plamlar bilan bajariladigan operatsiyalar.(To'plam o'zgarmaydi to'plamdan ma'lumotlar o'zgartirib olinadi)

1-to'plam va 2-to'plamda o'xshash elelmentlar mavjud bo'lsa yolg'on qiymat False qaytaradi.
1-to'plam va 2-to'plamda o'xshash elelmentlar mavjud bo'lmasa rost qiymat True qaytaradi.
print(t1.isdisjoint(t2))
True

3-to'plam 1-to'plamda mavjud bo'lsa rost qiymat True qaytaradi.
3-to'plam 1-to'plamda mavjud bo'lmasa yolg'on qiymat False qaytaradi.
print(t3.issubset(t1))
True

print(t3 <= t1)
True

1-to'plamda 3-to'plam mavjud bo'lsa rost qiymat True qaytaradi.
1-to'plamda 3-to'plam mavjud bo'lmasa yolg'on qiymat False qaytaradi.
print(t1.issuperset(t3))
True

print(t3 >= t1)
True

1-to'plamga boshqa to'plamlarni birlashtiradi.
print(t1.union(t2, t3))
{1, 2, 3, 7, 8, 9, 'z', 'w', 'a', 'b'}

print(t1 | t2 | t3)
{1, 2, 3, 7, 8, 9, 'z', 'w', 'a', 'b'}

#1-to'plam va 3-to'plamda bir xil qiymatga ega bo'lgan elementlarni chop qiladi.
print(t1.intersection(t3))
{'b', 'a'}

print(t1 & t3)
{'b', 'a'}

#3-to'plamda mavjud bo'lmagan 1-to'plamdagi elementlarni chop qiladi.
print(t1.difference(t3))
{1, 2, 3}

print(t1 - t3)
{1, 2, 3}

2 ta to'plamda bir xil qiymatga ega bo'lmagan elementlarni chop qiladi.
print({'a', 'b', 'c'}.symmetric_difference({'c', 'd', 'e'}))
{'e', 'd', 'a', 'b'}

print({'a', 'b', 'c'} ^ {'c', 'd', 'e'})
{'e', 'd', 'a', 'b'}

To'plam nusxasini qaytaradi.
print(t1.copy())
{1, 2, 3, 'a', 'b'}


To'plamlarni o'zgartiradigan operatsiyalar.(To'plam qiymatiga ta'sir qiladi ya'ni to'plamdagi ma'lumotlar o'zgaradi.)

To'plamdagi birinchi elelmentni o'chiradi.
print({1, 2, 3, 'a', 'b'}.pop())
1

print(t1)
{2, 3, 'a', 'b'}

1-to'plamga boshqa to'plamlarni birlashtirib saqlaydi.
tm = {2, 'a'}
tm.update({'a', 'z'}, {4, 2})
print(tm)
{'z', 2, 'a', 4}

1-to'plam va 2-to'plamda bir xil qiymatga ega bo'lgan elementlarni birlashtirib 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.intersection_update({'a', 'z'})
print(tm)
{'z', 'a'}

Boshqa to'plamlarda mavjud bo'lmagan 1-to'plamdagi elementlarni 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.difference_update({'a', 'z'}, {2})
print(tm)
{4}

2 ta to'plamda bir xil qiymatga ega bo'lmagan elementlarni 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.symmetric_difference_update({'a', 'z'})
print(tm)
{2, 4}

To'plamga element qo'shadi.

tm = {'z', 2, 'a', 4}
tm.add('b')
print(tm)
{'b', 2, 'z', 4, 'a'}

To'plamdagi elementni o'chiradi.Agarda ko'rsatilgan element to'plamda mavjud bo'lmasa KeyError xatoligini qaytaradi.

tm = {'z', 2, 'a', 4}
tm.remove('z')
print(tm)
{2, 4, 'a'}

To'plamdagi elementni o'chiradi.Agarda ko'rsatilgan element to'plamda mavjud bo'lmasa xatolik qaytarmaydi.

tm = {'z', 2, 'a', 4}
tm.discard('x')
print(tm)
{'z', 2, 4, 'a'}

To'plamni tozalaydi.
tm = {'z', 2, 'a', 4}
print(tm.clear())
None

@pythonuz



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

Ⓜ️ To'plam funksiyalari va uslublari

t1 = {1, 2, 3, 'a', 'b'}
t2 = {7, 8, 9, 'w', 'z'}
t3 = {'a', 'b'}

To'plamlar bilan bajariladigan operatsiyalar.(To'plam o'zgarmaydi to'plamdan ma'lumotlar o'zgartirib olinadi)

1-to'plam va 2-to'plamda o'xshash elelmentlar mavjud bo'lsa yolg'on qiymat False qaytaradi.
1-to'plam va 2-to'plamda o'xshash elelmentlar mavjud bo'lmasa rost qiymat True qaytaradi.
print(t1.isdisjoint(t2))
True

3-to'plam 1-to'plamda mavjud bo'lsa rost qiymat True qaytaradi.
3-to'plam 1-to'plamda mavjud bo'lmasa yolg'on qiymat False qaytaradi.
print(t3.issubset(t1))
True

print(t3 <= t1)
True

1-to'plamda 3-to'plam mavjud bo'lsa rost qiymat True qaytaradi.
1-to'plamda 3-to'plam mavjud bo'lmasa yolg'on qiymat False qaytaradi.
print(t1.issuperset(t3))
True

print(t3 >= t1)
True

1-to'plamga boshqa to'plamlarni birlashtiradi.
print(t1.union(t2, t3))
{1, 2, 3, 7, 8, 9, 'z', 'w', 'a', 'b'}

print(t1 | t2 | t3)
{1, 2, 3, 7, 8, 9, 'z', 'w', 'a', 'b'}

#1-to'plam va 3-to'plamda bir xil qiymatga ega bo'lgan elementlarni chop qiladi.
print(t1.intersection(t3))
{'b', 'a'}

print(t1 & t3)
{'b', 'a'}

#3-to'plamda mavjud bo'lmagan 1-to'plamdagi elementlarni chop qiladi.
print(t1.difference(t3))
{1, 2, 3}

print(t1 - t3)
{1, 2, 3}

2 ta to'plamda bir xil qiymatga ega bo'lmagan elementlarni chop qiladi.
print({'a', 'b', 'c'}.symmetric_difference({'c', 'd', 'e'}))
{'e', 'd', 'a', 'b'}

print({'a', 'b', 'c'} ^ {'c', 'd', 'e'})
{'e', 'd', 'a', 'b'}

To'plam nusxasini qaytaradi.
print(t1.copy())
{1, 2, 3, 'a', 'b'}


To'plamlarni o'zgartiradigan operatsiyalar.(To'plam qiymatiga ta'sir qiladi ya'ni to'plamdagi ma'lumotlar o'zgaradi.)

To'plamdagi birinchi elelmentni o'chiradi.
print({1, 2, 3, 'a', 'b'}.pop())
1

print(t1)
{2, 3, 'a', 'b'}

1-to'plamga boshqa to'plamlarni birlashtirib saqlaydi.
tm = {2, 'a'}
tm.update({'a', 'z'}, {4, 2})
print(tm)
{'z', 2, 'a', 4}

1-to'plam va 2-to'plamda bir xil qiymatga ega bo'lgan elementlarni birlashtirib 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.intersection_update({'a', 'z'})
print(tm)
{'z', 'a'}

Boshqa to'plamlarda mavjud bo'lmagan 1-to'plamdagi elementlarni 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.difference_update({'a', 'z'}, {2})
print(tm)
{4}

2 ta to'plamda bir xil qiymatga ega bo'lmagan elementlarni 1-to'plamda saqlaydi.

tm = {'z', 2, 'a', 4}
tm.symmetric_difference_update({'a', 'z'})
print(tm)
{2, 4}

To'plamga element qo'shadi.

tm = {'z', 2, 'a', 4}
tm.add('b')
print(tm)
{'b', 2, 'z', 4, 'a'}

To'plamdagi elementni o'chiradi.Agarda ko'rsatilgan element to'plamda mavjud bo'lmasa KeyError xatoligini qaytaradi.

tm = {'z', 2, 'a', 4}
tm.remove('z')
print(tm)
{2, 4, 'a'}

To'plamdagi elementni o'chiradi.Agarda ko'rsatilgan element to'plamda mavjud bo'lmasa xatolik qaytarmaydi.

tm = {'z', 2, 'a', 4}
tm.discard('x')
print(tm)
{'z', 2, 4, 'a'}

To'plamni tozalaydi.
tm = {'z', 2, 'a', 4}
print(tm.clear())
None

@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/491

View MORE
Open in Telegram


Python dasturlash maktabi Telegram | DID YOU KNOW?

Date: |

Should You Buy Bitcoin?

In general, many financial experts support their clients’ desire to buy cryptocurrency, but they don’t recommend it unless clients express interest. “The biggest concern for us is if someone wants to invest in crypto and the investment they choose doesn’t do well, and then all of a sudden they can’t send their kids to college,” says Ian Harvey, a certified financial planner (CFP) in New York City. “Then it wasn’t worth the risk.” The speculative nature of cryptocurrency leads some planners to recommend it for clients’ “side” investments. “Some call it a Vegas account,” says Scott Hammel, a CFP in Dallas. “Let’s keep this away from our real long-term perspective, make sure it doesn’t become too large a portion of your portfolio.” In a very real sense, Bitcoin is like a single stock, and advisors wouldn’t recommend putting a sizable part of your portfolio into any one company. At most, planners suggest putting no more than 1% to 10% into Bitcoin if you’re passionate about it. “If it was one stock, you would never allocate any significant portion of your portfolio to it,” Hammel says.

What is Telegram?

Telegram’s stand out feature is its encryption scheme that keeps messages and media secure in transit. The scheme is known as MTProto and is based on 256-bit AES encryption, RSA encryption, and Diffie-Hellman key exchange. The result of this complicated and technical-sounding jargon? A messaging service that claims to keep your data safe.Why do we say claims? When dealing with security, you always want to leave room for scrutiny, and a few cryptography experts have criticized the system. Overall, any level of encryption is better than none, but a level of discretion should always be observed with any online connected system, even Telegram.

Python dasturlash maktabi from us


Telegram Python dasturlash maktabi
FROM USA