Answers for "python to tuple"

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
-1

how to view a tuple

data[0]
Posted by: Guest on June-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language