FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
programminginpython.com/tupleOperations.py at master · anilkumarreddyn/programminginpython.com · GitHub
anilkumarreddyn
/
programminginpython.com
Public
forked from
avinashn/programminginpython.com
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
programminginpython.com
/
tupleOperations.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (26 loc) · 948 Bytes
Breadcrumbs
programminginpython.com
/
tupleOperations.py
Copy path
File metadata and controls
34 lines (26 loc) · 948 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
__author__
=
'Avinash'
tup
=
(
'abc'
,
'def'
,
'ghi'
,
'jklm'
,
'nopqr'
,
'st'
,
'uv'
,
'wxyz'
,
'23'
,
's98'
,
'123'
,
'87'
)
# prints the length of the tuple
print
(
'
\n
tuple: '
,
tup
)
print
(
'Length of the tuple is : '
,
len
(
tup
))
# Slicing
# shows only items starting from 0 upto 3
print
(
'
\n
tuple: '
,
tup
)
print
(
'tuple showing only items starting from 0 upto 3
\n
'
,
tup
[:
3
])
# shows only items starting from 4 to the end
print
(
'
\n
tuple: '
,
tup
)
print
(
'tuple showing only items starting from 4 to the end
\n
'
,
tup
[
4
:])
# shows only items starting from 2 upto 6
print
(
'
\n
tuple: '
,
tup
)
print
(
'tuple showing only items starting from 2 upto 6
\n
'
,
tup
[
2
:
6
])
# reverse all items in the tuple
print
(
'
\n
tuple: '
,
tup
)
print
(
'tuple items reversed
\n
'
,
tup
[::
-
1
])
# removing whole tuple
del
tup
tup_0
=
(
"ere"
,
"sad"
)
tup_1
=
(
"sd"
,
"ds"
)
print
(
'
\n
first tuple: '
,
tup_0
)
print
(
'second tuple: '
,
tup_1
)
tup
=
tup_0
+
tup_1
print
(
'Concatenation of 2 tuples
\n
'
,
tup
)
Back
|
FazBrowse Home
|
New Git URL