PYPROGLIB Telegram 5885
🐍 Распаковка кортежей в Python

Это полезный лайфхак, который не только улучшит читаемость кода, но и может повысить его корректность.

Распаковка кортежей в Python может выглядеть так:

point = (1, 2, 3)
x, y, z = point


Или так:
[first, *rest] = point


А также:
for (x1, y1), (x2, y2) in zip(start_points, end_points): 
if x1 == -x2 and y1 == -y2:
print(f'Point {x1},{y1} was negated.')


#советы
🤩9👍4



tgoop.com/pyproglib/5885
Create:
Last Update:

🐍 Распаковка кортежей в Python

Это полезный лайфхак, который не только улучшит читаемость кода, но и может повысить его корректность.

Распаковка кортежей в Python может выглядеть так:

point = (1, 2, 3)
x, y, z = point


Или так:
[first, *rest] = point


А также:
for (x1, y1), (x2, y2) in zip(start_points, end_points): 
if x1 == -x2 and y1 == -y2:
print(f'Point {x1},{y1} was negated.')


#советы

BY Библиотека питониста | Python, Django, Flask


Share with your friend now:
tgoop.com/pyproglib/5885

View MORE
Open in Telegram


Telegram News

Date: |

Ng Man-ho, a 27-year-old computer technician, was convicted last month of seven counts of incitement charges after he made use of the 100,000-member Chinese-language channel that he runs and manages to post "seditious messages," which had been shut down since August 2020. Some Telegram Channels content management tips The visual aspect of channels is very critical. In fact, design is the first thing that a potential subscriber pays attention to, even though unconsciously. As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces. Telegram Channels requirements & features
from us


Telegram Библиотека питониста | Python, Django, Flask
FROM American