How to use map() to multiply a range of numbers in Python

1 Answer

0 votes
from itertools import *     

for val in map(lambda x, y: (x, y, x * y), repeat(3), range(7)):         
    print('{:d} * {:d} = {:d}'.format(*val))



'''
run:
 
3 * 0 = 0
3 * 1 = 3
3 * 2 = 6
3 * 3 = 9
3 * 4 = 12
3 * 5 = 15
3 * 6 = 18

'''

 



answered May 21, 2019 by avibootz

Related questions

1 answer 109 views
1 answer 226 views
1 answer 104 views
2 answers 233 views
1 answer 182 views
...