Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

WilsonWorla

  • 3 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
    • 3 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
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Why you keep reposting this question?

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

    Cos i haven'st got my answer yet.

  4. WilsonWorla
    • 3 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
    • 3 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
    • 3 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

Sign Up
Find more explanations on OpenStudy
Privacy Policy