Question

Python: Write a program that makes sum of 1, 2, 3, … until the sum is...

Python: Write a program that makes sum of 1, 2, 3, … until the sum is over 1000.

Homework Answers

Answer #1

#Python program to sum natural numbers(1,2,3,4,5,6,7,8,9,10.................N)  until sum is over 1000
sum = 0
j=1
while sum < 1001:
sum=sum+j
j=j+1
  

print("\n \nthe sum of first ",j," natural numbers is",sum)

Screenshot code:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a Python program using while loop that finds and prints the sum of this geometric...
Write a Python program using while loop that finds and prints the sum of this geometric series. 1 + 2 +4 +8 + … + 1024
Python code Write a complete program with for loop which calculates the sum of the numbers...
Python code Write a complete program with for loop which calculates the sum of the numbers from 1 to 100
Write a Python program to find the sum of the binary numbers in list L, where...
Write a Python program to find the sum of the binary numbers in list L, where the binary numbers do not have the quote marks necessary for the int() function. For example, if L = [101, 11, 1010] then the sum is 5 + 3 + 10 = 18. What is the sum when L is L = [10100, 101000, 100000, 1011111, 1000, 1010111, 1010010, 11001, 101100, 10111, 11011, 1011010, 11101, 10, 110011, 1001111, 110010, 101100, 100001, 111001]
Python Practice Sample: Write a program to simulate rolling a 6-sided die until the sum of...
Python Practice Sample: Write a program to simulate rolling a 6-sided die until the sum of the numbers rolled is equal to or greater than 21. If it is exactly 21, print “You won!”; if it is more than 21, print “You lost!.” Show the number rolled and the accumulated total each time. Number rolled: 6. Your total is now: 6. Number rolled: 6. Your total is now: 12. Number rolled: 4. Your total is now: 16. Number rolled: 1....
Write a program that adds the sum of digits in an integer and loops until 0...
Write a program that adds the sum of digits in an integer and loops until 0 is entered to end the program C++.
Write a python program to find the sum of the first n natural numbers, where the...
Write a python program to find the sum of the first n natural numbers, where the value of n is provided by the user. What is the sum of the first 200 numbers? Write a program that finds the average of a series of numbers entered by the user. As in the previous problem, the program will first ask the user how many numbers there are. Note: the average should always be a float. What is the average of 10.2,...
Write a python program that generates a sudoku puzzle.1. Enter n (which is the size of...
Write a python program that generates a sudoku puzzle.1. Enter n (which is the size of the sudoku puzzle #2. Keep generating random permutations of n using python built in function until you find permutation that can be incorporated as a new component of the sudoku grid. format for puzzle should be output 1 2 3 3 1 2 2 3 1
(Python Programming) Write a program that prompts a user for a positive integer and then uses...
(Python Programming) Write a program that prompts a user for a positive integer and then uses a loop to calculate and display the sum of specific fractions as follows: Let's say the user enters 5, then your program will compute: 1/5 + 2/4 + 3/3 + 4/2 + 5/1 which is 8.7.
11. Write a program to compute the sum of the series 12 + 22 + 32....
11. Write a program to compute the sum of the series 12 + 22 + 32. . . ., such that the sum is doesnot exceed 1000. The program should display how many terms are used in the sum. {3 marks} matlab only 1 to power of 2 , 2 to the power of 2 , 3 to the power of 3 , not 12 + 22 + 32
C++ [Program-2] Write a program that accepts an indefinite set of numbers until the user enters...
C++ [Program-2] Write a program that accepts an indefinite set of numbers until the user enters “-1”. In other words, the program keeps accepting new values until the user provides a “-1” (your program accepts all values, and discards the “-1”). When done, the program prints back to the user: (i) the sum of all numbers entered (except -1), (ii) the minimum value seen across all numbers (except -1), and (iii) the maximum value across all numbers (except -1).