Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

tuple with mixed data types

#Creating a Tuple
#with Mixed Datatype
Tuple1 = (5, 'Softhunt', 7, 'Tutorials')
print("
Tuple with Mixed Datatypes: ")
print(Tuple1)
 
#Creating a Tuple
#with nested tuples
Tuple1 = (0, 1, 2, 3)
Tuple2 = ('python', 'Softhunt')
Tuple3 = (Tuple1, Tuple2)
print("
Tuple with nested tuples: ")
print(Tuple3)
 
#Creating a Tuple
#with repetition
Tuple1 = ('Softhunt',) * 3
print("
Tuple with repetition: ")
print(Tuple1)
 
#Creating a Tuple
#with the use of loop
Tuple1 = ('Softhunt')
n = 5
print("
Tuple with a loop")
for i in range(int(n)):
    Tuple1 = (Tuple1,)
    print(Tuple1)
Comment

Creating a Tuple with Mixed Datatypes.

# Creating a Tuple
# with Mixed Datatype
Tuple1 = (5, 'Welcome', 7, 'Geeks')
print("
Tuple with Mixed Datatypes: ")
print(Tuple1)
 
# Creating a Tuple
# with nested tuples
Tuple1 = (0, 1, 2, 3)
Tuple2 = ('python', 'geek')
Tuple3 = (Tuple1, Tuple2)
print("
Tuple with nested tuples: ")
print(Tuple3)
 
# Creating a Tuple
# with repetition
Tuple1 = ('Geeks',) * 3
print("
Tuple with repetition: ")
print(Tuple1)
 
# Creating a Tuple
# with the use of loop
Tuple1 = ('Geeks')
n = 5
print("
Tuple with a loop")
for i in range(int(n)):
    Tuple1 = (Tuple1,)
    print(Tuple1)
Comment

PREVIOUS NEXT
Code Example
Python :: accessing multiple elements from the list 
Python :: Math Module fabs() Function in python 
Python :: Code to find maximum number using if else 
Python :: droping columns 
Python :: en python quand on utilise = et== 
Python :: lime python interpretation 
Python :: write console output in same place 
Python :: print using multiply only 
Python :: python comment faire une boucle 
Python :: how to stop a function from returning none 
Python :: affochage dun index du array list a deux dimension 
Python :: import variables fron another file 
Python :: Elasticsearch scroll with Parallelism r 
Python :: comments 
Python :: Python NumPy transpose Function Example with use of tuples 
Python :: how to change the color of console output in python to green 
Python :: data framing with Pandas 
Python :: Python NumPy stack Function Syntax 
Python :: button to redirect to another tree view in odoo 
Python :: mid-point line drawing 
Python :: __ne__ 
Python :: use every character with python to get probabilities 
Python :: NumPy packbits Code Packed array along default axis 
Python :: How to use "to_representation" hook for django rest serializers 
Python :: python list and numpy array 
Python :: numpy extract decimal 
Python :: rasa emotion bot 
Python :: Examples of correct code for this rule with global declaration: 
Python :: how do i add two matrix and store it in a list in python 
Python :: How to solve import errors while trying to deploy Flask using WSGI on Apache2 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =