Question

write a python program which finds three consecutive odd numbers whose sum adds up to 45...

write a python program which finds three consecutive odd numbers whose sum adds up to 45 and return a list of the numbers in ascending order

do not use any other packages such as numpy or math
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let me explain the maths behind the solution below -
Since the numbers are consecutive odd numbers, let the numbers be n-2,n,n+2
So, (n-2)+n+(n+2) = 45
3n = 45
n = 15

Python function -
def function(total): #total is sum of consecutive odd integers
n = total//3
return [n-2,n,n+2]

Add a comment
Know the answer?
Add Answer to:
write a python program which finds three consecutive odd numbers whose sum adds up to 45...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python 3.6 "While Loops" Write a program that adds up a series of numbers entered by...

    Python 3.6 "While Loops" Write a program that adds up a series of numbers entered by the user. The user should enter each number at the command prompt. The user will indicate that he or she is finished entering the number by entering the number 0.   Example This program will sum a series of numbers. Enter the next number (enter 0 when finished) > 5 Enter the next number (enter 0 when finished) > 2 Enter the next number (enter...

  • USE PYTHON: 4) [30pts] Write program which finds the followings for the given values between 150...

    USE PYTHON: 4) [30pts] Write program which finds the followings for the given values between 150 to 1000 a) How many odd numbers are between 150 and 1000 (include 150 and 1000) b) Find the sum of odd numbers which are between 150 and 1000 (include 150 and 1000) c) Find the multiplication of odd numbers which are between 150 and 1000 (include 150 and 1000) d) Find the sum of square of odd numbers which are between 150 and...

  • Write a C program to sum up all the odd numbers between a lower limit number...

    Write a C program to sum up all the odd numbers between a lower limit number and an upper limit number provided by a user. The requirements are: First, request the user to provide a lower limit integer number and an upper limit integer number that is larger than the lower limit number, and save them in variables lowerLimit and upperLimit, respectively. If the user has entered an upper limit number (upper Limit) that is NOT larger than the lower...

  • 6.2 - Write a program that reads numbers and adds them to a list if they...

    6.2 - Write a program that reads numbers and adds them to a list if they aren't already contained in the list. When the list contains ten numbers, the program displays the contents and quits. Use Python 3 Please. Comments in code if you can

  • write a c++ program to find the sum, average, highest, lowest, odd, and even numbers of...

    write a c++ program to find the sum, average, highest, lowest, odd, and even numbers of a list of 10 numbers. apply arrays and functions. ==> NOTE: main program must contain only calls and declarations.

  • Script 1: Sum of Numbers Write a python program that asks the user to enter a...

    Script 1: Sum of Numbers Write a python program that asks the user to enter a series of single-digit numbers with nothing separating them. The program should display the sum of all the single digit numbers in the string. For example, if the user enters 2514, the method should return 12, which is the sum of 2, 5, 1, and 4.

  • Write a program to find the sum of all odd numbers recursively less than or equal...

    Write a program to find the sum of all odd numbers recursively less than or equal to n starting from 1, where n is any positive number. So for example n is 11 find sum of the following numbers (1,3,5,7,9,11) Write this in java please

  • java program: Write a program which displays the following list on the screen and asks the...

    java program: Write a program which displays the following list on the screen and asks the user to enter either 1 or 2 and perform one of the operations based on the user’s input. If the user enters any other character other than 1 or 2 then display “wrong choice”. LIST OF OPERATIONS 1. Buzz Number                      2. Consecutive Odd numbers Note: A BUZZ number is a number which either ends with 7 or is divisible by 7. Sample input 27...

  • use python: Write a program that reads in X whole numbers and outputs (1) the sum...

    use python: Write a program that reads in X whole numbers and outputs (1) the sum of all positive numbers, (2) the sum of all negative numbers, and (3) the sum of all positive and negative numbers. The user can enter the X numbers in any different order every time, and can repeat the program if desired. Sample Run How many numbers would you like to enter? 4 Please enter number 1: 3 Please enter number 2: -4 Please enter...

  • Write a python program that generates a list of 50 random numbers. The program should display...

    Write a python program that generates a list of 50 random numbers. The program should display (with labels) the sum, average, largest, and smallest of the list along with the list before and after sorting. Bonus: Find the mode (if any)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT