filmov
tv
Write a Python Program to Convert a Tuple of String Values to a Tuple of Integer Values

Показать описание
Hello Programmers, Welcome to my channel.
In this video you will learn about how to Write a Python Program to Convert a Tuple of String Values to a Tuple of Integer Values
Python Scripts
======================
Python Functions Solved
==========================
Python Programs Solved
============================
Code
=============================
def convert(my_tuple):
local_tuple = tuple()
for item in my_tuple:
if isinstance(item, tuple):
local_tuple += (convert(item),)
elif isinstance(item, str):
local_tuple += (int(item),)
return local_tuple
data = (("33", "44"), ("14", "55"), "23", ("1", "2", "3", ("11", "22")), ("4", "5", "6", "7"))
info = convert(data)
print("Tuple of Strings ... ")
print(data)
print("Tuple of Integers ...")
print(info)
Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners
In this video you will learn about how to Write a Python Program to Convert a Tuple of String Values to a Tuple of Integer Values
Python Scripts
======================
Python Functions Solved
==========================
Python Programs Solved
============================
Code
=============================
def convert(my_tuple):
local_tuple = tuple()
for item in my_tuple:
if isinstance(item, tuple):
local_tuple += (convert(item),)
elif isinstance(item, str):
local_tuple += (int(item),)
return local_tuple
data = (("33", "44"), ("14", "55"), "23", ("1", "2", "3", ("11", "22")), ("4", "5", "6", "7"))
info = convert(data)
print("Tuple of Strings ... ")
print(data)
print("Tuple of Integers ...")
print(info)
Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners