Q:

Write a Python program to convert a given heterogeneous list of scalars into a string.

0

Write a Python program to convert a given heterogeneous list of scalars into a string. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def heterogeneous_list_to_str(lst):
    result = ','.join(str(x) for x in lst)
    return result
h_data = ["Red", 100, -50, "green", "w,3,r", 12.12, False]
print("Original list:")
print(h_data)
print("\nConvert the heterogeneous list of scalars into a string:")
print(heterogeneous_list_to_str(h_data))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now