Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

WilsonWorla

  • 2 years ago

Write a program that finds a.sum b. average c.product of sum and average for all numbers divisble by 7. The user should provide both the upper bound and the lower bound 2.write a program that finds the minimum number out of n numbers and the user should provide the numbers NB: All programs should be in python

  • This Question is Closed
  1. estudier
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    a) sum(range(1,11)) #sums numbers from 1 to 10 inclusive

  2. estudier
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Why you keep reposting this question?

  3. WilsonWorla
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Cos i haven'st got my answer yet.

  4. WilsonWorla
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I want to modify this python program: n = int(input ("enter the number input; ")) sumN = 0 for nCount in range(n): inputNumber = int(input("Enter your next number; ")) sumN += inputNumber average = sumN/n print "The sum of the number is; ",sumN print "The average of the number is; ",average to meet the requirements of of the question posed.

  5. DanSraer
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    this is my solution for your first request: a = input("Enter the lower bound: ") b = input("Enter the upper bound: ") def my_function(a, b): if type(a) == int and type(b) == int: my_list = [] for i in range(a, b + 1): if i % 7 == 0: my_list.append(i) my_sum = float(sum(my_list)) my_average = float(my_sum / len(my_list)) my_product = my_sum * my_average print my_sum print my_average print my_product else: print "Invalid input data" my_function(a, b)

  6. DanSraer
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    my solution for your second request is: my_list = [] def my_function(*args): response = raw_input("Do you want to introduce a new number? ") if response != "y" and "Y": print "This program ends now." else: n = input("Your number is: ") my_list.append(n) my_function() my_function() print "The answer is: ", min(my_list)

  7. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.