An Alternative Way to Create a Tuple in Python
An alternative way to create a tuple is to use the tuple function. The required elements or objects are passed to its parameter.
Let's make a tuple by passing a string to the function parameter:
pythontpl = tuple('abcde')
print(tpl) # ('a', 'b', 'c', 'd', 'e')
However, numbers cannot be passed to the tuple function:
pythontpl = tuple(1234)
print(tpl) # will display an error
Задание 1
Given a variable:
pythontst = '12345'
Create a tuple from it.
Задание 2
Given a string:
pythontxt = '12345'
Split this string into the following tuple:
pythontpl = ('1', '2', '3', '4', '5')
Задание 3
Given a variable:
pythontst = 98765
Create a tuple from it:
pythontpl = ('9', '8', '7', '6', '5')