Write a program to print the product of integers in a mixed list of string and numbers


Topic: Write a program to print the product of integers in a mixed list of string and numbers

Solution

test_list = [5, 8, "gfg", 8, (5, 7), 'is', 2] 
res = 1
for ele in test_list: 
    try: 
        res *= int(ele) 
    except : 
        pass
print("Product of integers in list : " + str(res))



List all Python Programs