Answers for "define tuple in python"

2

tuples in python

my_tuple = ("hello")
print(type(my_tuple))  # <class 'str'>

# Creating a tuple having one element
my_tuple = ("hello",)
print(type(my_tuple))  # <class 'tuple'>

# Parentheses is optional
my_tuple = "hello",
print(type(my_tuple))  # <class 'tuple'>
Posted by: Guest on October-12-2020
4

tuple in python

#a tuple is basically the same thing as a
#list, except that it can not be modified.
tup = ('a','b','c')
Posted by: Guest on March-14-2020
0

tuplein python

a=(1,2,3,4)
print(a[-3])
Posted by: Guest on July-09-2021
0

how to make a tuple

thistuple = ("apple", "banana", "cherry")

print(thistuple)
Posted by: Guest on May-19-2021
0

what is tuple in python

tuple
Posted by: Guest on June-26-2021
0

tuple python

#tuple
#they are similar to lists but with property of immutable
#and use of parentheses they become variant.
#tuples seperate the objects with notation as commas.
tup=(55,4.00,5,9,9,3.0,9j,3)
print(tup).....................(55,4.00,5,9,9,3.0,9j,3)
tup[3]
print(tup).................9
#functions used here are
count,index
tup.count(9).....................2

tup.index(4.0)....................1
-----------------------------------------------------------------
Posted by: Guest on November-27-2021

Browse Popular Code Answers by Language