How to convert a list into a tuple in Python?
Answers
Answered by
0
Life is a precious experience that can disappear in a moment's notice. The stories, experiences and lessons we develop over a lifetime are amazing gifts that can be shared with family, friends and other loved ones. The Leather Book Library team believes every individual should have the opportunity to document their life story in a timeless leather bound classic. Whether it be for you or a loved one, allow us to help you on your journey to leave behind a legacy!
Answered by
0
Convert tuple into list
Explanation:
#define function
def con(lst):
#convert list into tuple
return tuple(lst)
lst=[23,43,54,12,22,78]
print(con(lst))
The following are description of the program.
- Firstly, define function 'con()' and pass argument 'lst' in its parameter.
- Then, convert the list into the tuple through the 'tuple()' pre-defined function that converts the string or list into the tuple and return that converted tuple.
- Finally, declare and initialize the list variable to '[23,43,54,12,22,78] ' then, call and print the function by passing argument in its parameter.
Learn More:
https://brainly.in/question/13319756
Similar questions