Knowee
Questions
Features
Study Tools

Create a program to calculate the sum of numbers entered by the user. The program should ask the user "How many numbers do like to get their sum?:". According to user's answers, use for loop to read integer numbers from the user and display their sum. Refer to the examples below.Use the following two lines of code at the beginning of your answer:print("How many numbers do like to get their sum?:")nums=int(input())sum = 0For example:Test Input Result1512345How many numbers do like to get their sum?:Sum of all numbers is 152369-5How many numbers do like to get their sum?:Sum of all numbers is 1031-10How many numbers do like to get their sum?:Sum of all numbers is -10

Question

Create a program to calculate the sum of numbers entered by the user. The program should ask the user "How many numbers do like to get their sum?:". According to user's answers, use for loop to read integer numbers from the user and display their sum. Refer to the examples below.Use the following two lines of code at the beginning of your answer:print("How many numbers do like to get their sum?:")nums=int(input())sum = 0For example:Test Input Result1512345How many numbers do like to get their sum?:Sum of all numbers is 152369-5How many numbers do like to get their sum?:Sum of all numbers is 1031-10How many numbers do like to get their sum?:Sum of all numbers is -10

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

print("How many numbers do like to get their sum?:") nums = int(input()) sum = 0

for i in range(nums): number = int(input()) sum += number

print("Sum of all numbers is", sum)

Similar Questions

Write a program that reads in a number (integer) as input, adds 1 to it, and then prints out the result. Here is an example interaction between your program and the user:Please enter a number: 34

Write a program that repeatedly asks for numbers. When the user enters 0, the program prints the average of all numbers entered (excluding the 0) accurate to two decimal places and exits.

create a Python script with a recursive function to display the sum of the first n integers, where n is entered by the user. There is no need to create a class similar to how Java works. 2. Name your function find_sum.

You need to create an app that calculates the sum of the numbers 1 to N, where N is taken from input.For example, for the number 5, the output should be 15, because 1+2+3+4+5=15.

Read one string, within that string we have numerical values also, then we have to display the sum of that numbers in that string.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.