Menu

Using Python3 Modify Program Multiples 3 5 Considered Sum Product Q43857977

USING PYTHON3 Modify the program below suchthat only multiples of 3 or 5 are considered in the sum andproduct.

print() 2 4 # Taking value from user using input function # And we know that input() function takes value as string so, we ty

print() 2 4 # Taking value from user using input function # And we know that input() function takes value as string so, we typecast it to int using int() function n = int(input(“Enter the value of n: “)) # Intializing totalSum variable as 0 # Intializing product variable as 1 totalSum = 0 product = 1 # To calcualte sum and product we use for loop # range(n) will take value of i variable from 0 to n-1 # So, at calculating sum and product we use (i+1) for i in range(n): totalSum = totalSum+i+1, product = product*(i+1), # Displaying the value of sum and product using print() function print(“The sum of the first n values is :”, totalSum), print(“The product of the first n values is: “, product) 1 print Show transcribed image text print() 2 4 # Taking value from user using input function # And we know that input() function takes value as string so, we typecast it to int using int() function n = int(input(“Enter the value of n: “)) # Intializing totalSum variable as 0 # Intializing product variable as 1 totalSum = 0 product = 1 # To calcualte sum and product we use for loop # range(n) will take value of i variable from 0 to n-1 # So, at calculating sum and product we use (i+1) for i in range(n): totalSum = totalSum+i+1, product = product*(i+1), # Displaying the value of sum and product using print() function print(“The sum of the first n values is :”, totalSum), print(“The product of the first n values is: “, product) 1 print

Expert Answer


Answer to USING PYTHON3 Modify the program below such that only multiples of 3 or 5 are considered in the sum and product….

OR