Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to multiply two tuples in python

#If you want to multiply the content of a tuple a given number of times, 
#you can use the * operator:

#Multiply the fruits tuple by 2:

fruits = ("apple", "banana", "cherry")
mytuple = fruits * 2

print(mytuple)

#Ouput: ('apple', 'banana', 'cherry', 'apple', 'banana', 'cherry')
 
PREVIOUS NEXT
Tagged: #multiply #tuples #python
ADD COMMENT
Topic
Name
6+4 =