top of page

Write a program to Multiply the List in Python

Writer's picture: The Tech PlatformThe Tech Platform

Updated: Dec 16, 2021



This program allows user to define the size of list, then further ask to enter all the numbers of given size. For example, if user enters 10 as size, then program ask to enter 10 numbers, then multiplies all 10 numbers together and prints the multiplication result like shown in the program given below:


Code:

nums = list()

print(end="Enter the size of list you want to multiply: ")
numsSize = int(input())
print(end="Enter " +str(numsSize)+ " Numbers: ")
for i in range(numsSize):
  nums.append(int(input()))

mul = 1
for i in range(numsSize):
  mul = mul*nums[i]
print("\nMultiplication Result = " +str(mul))


Output:









Read More:



The Tech Platform

0 comments

Comentários


bottom of page