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]
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
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++.
(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
write a program in python for following x = { 'a' : 1 , 'b':2 ,...
write a program in python for following x = { 'a' : 1 , 'b':2 , 'c':3, 'd':4 } For the following key,value pairs of dictionary display those which are even values i.e for which the value is even. i am trying like this but getting confused. (k:v for k,v in x.items() if v%2 != 0
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...
Write a program that prompts the user for a number from 1 to 200 until 113...
Write a program that prompts the user for a number from 1 to 200 until 113 is encountered. Not including the 113, calculate the average. Do this in python. DO NOT USE LISTS!
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT