PYTHONPOOL Telegram 267
⚠️ Daily Python Facts ⚠️

Python’s special Slice Operator.

# Slice Operator
a = [1,2,3,4,5]

print(a[0:2]) # Choose elements [0-2), upper-bound noninclusive

print(a[0:-1]) # Choose all but the last

print(a[::-1]) # Reverse the list

print(a[::2]) # Skip by 2

print(a[::-2]) # Skip by -2 from the back

Output:
[1, 2]
[1, 2, 3, 4]
[5, 4, 3, 2, 1]
[1, 3, 5]
[5, 3, 1]


- @pythonpool -



tgoop.com/pythonpool/267
Create:
Last Update:

⚠️ Daily Python Facts ⚠️

Python’s special Slice Operator.

# Slice Operator
a = [1,2,3,4,5]

print(a[0:2]) # Choose elements [0-2), upper-bound noninclusive

print(a[0:-1]) # Choose all but the last

print(a[::-1]) # Reverse the list

print(a[::2]) # Skip by 2

print(a[::-2]) # Skip by -2 from the back

Output:
[1, 2]
[1, 2, 3, 4]
[5, 4, 3, 2, 1]
[1, 3, 5]
[5, 3, 1]


- @pythonpool -

BY Python Pool | Python Course | Machine Learning | Data Science Tutorials | Artificial Intelligence | Computer Science Programming


Share with your friend now:
tgoop.com/pythonpool/267

View MORE
Open in Telegram


Telegram News

Date: |

Image: Telegram. With the “Bear Market Screaming Therapy Group,” we’ve now transcended language. The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. Telegram iOS app: In the “Chats” tab, click the new message icon in the right upper corner. Select “New Channel.”
from us


Telegram Python Pool | Python Course | Machine Learning | Data Science Tutorials | Artificial Intelligence | Computer Science Programming
FROM American