Answers for "python tuple range"

0

python tuple range

sample = tuple(range(100))
# beg, end, step (end is not included)
print(sample[69: 100])  # has numbers in range [69, 99)
print(sample[2: 68: 2]) # all numbers from 2 to 68 (excluding 68) with step 2
print(sample[69:]) # from 69 to end
print(sample[::-1]) # reversed ones
Posted by: Guest on August-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language