Answers for "create tuple python"

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

make a tuple

#you can put a lotta stuff in tuples
tup = ("string", 2456, True)
Posted by: Guest on January-21-2021
0

ways to create tuple in python

# There are more ways to create a TUPLE in Python.

# First of all, a TUPLE is usually created by:
# (STEP 1) creating a Parethesis ()
# (STEP 2) putting a value in Parenthesis. Example: (3)
# (STEP 3) putting more value by adding Comma. Example: (3, 4)
# (STEP 4) Repeat Step 3 if u want to add more value. Example: (3, 4, coffee)
# That's how to create TUPLE

# EXAMPLE
adsdfawea = (123, 56.3, 'cheese')

# But did you know, you can create TUPLE without any value inside the () ???
wallet = ()
print(type(wallet))

# But did you know, you can create TUPLE without parenthesis () ???
plate = 'cake',
print(type(plate))

# As you can see, STRING is possible in TUPLE, not just INTEGERS or FLOATS.
Posted by: Guest on September-05-2021
0

what is tuple in python

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

python tuple create tuple

--It is also possible to use the tuple() constructor to make a tuple.
thistuple = tuple(("apple", "banana", "cherry")) # note the double round-brackets

print(thistuple)
Posted by: Guest on September-24-2021
0

python tuples

#!/usr/bin/python

tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5, 6, 7 );
print "tup1[0]: ", tup1[0];
print "tup2[1:5]: ", tup2[1:5];
Posted by: Guest on November-21-2021

Browse Popular Code Answers by Language