Python Program To Display Powers of 2 Using Anonymous Function


Topic: Python Program To Display Powers of 2 Using Anonymous Function

Solution

terms = 10
result = list(map(lambda x: 2 ** x, range(terms)))
print("The total terms are:",terms)
for i in range(terms):
   print("2 raised to power",i,"is",result[i])



List all Python Programs