1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anettt [7]
3 years ago
13

Write two versions of a program that reads a sequence of positive integers from the user, calculates their geometric mean, and p

rint the geometric mean. Note: In mathematics, geometric mean of a dataset {a1, a2, a3 ..., an} is given by: a1 For example, the geometric mean of 2,9 and 12 is equal to 6 (V2 -9 12 = Your two versions of the program should read the integer sequence in two ways:
a) First read the length of the sequence For example, an execution would look like: Please enter the length of the sequence: 3 Please enter your sequence: a2 a3 an 6). 1 2 3 The geometric mean is: 1.8171
b) Keep reading the numbers until 'done' is entered. For example, an execution would look like: Please enter a non-empty sequence of positive integers, each one in a separate line. End your sequence by typing done: 1 2 3 done The geometric mean is: 1.8171
Computers and Technology
1 answer:
givi [52]3 years ago
4 0

Answer:

1)

n = int(input("Please enter the length of the sequence: "))

print("Please enter your sequence")

product = 1

for i in range(n):

   val = int(input())

   product *= val

print("The geometric mean is: %.4f"%pow(product,1/n))

2)

print("Please enter a non-empty sequence of positive integers, each one is in a separate line. End your sequence by typing done:")

product = 1

val = input()

n = 0

while(val!="done"):

   product *= int(val)

   n += 1

   val = input()

print("The geometric mean is: %.4f"%pow(product,1/n))

Explanation:

You might be interested in
Who invented slide Rule and when?​
podryga [215]
Invented by William Oughtred in the 1600s but only used in the mid 1800s
3 0
3 years ago
Read 2 more answers
Professionally, depending on your career, you might use Excel to:
morpeh [17]

1. To track inventory on excel you should have thorough knowledge on how it is used and different techniques and buttons behave on it. Tracking inventory may use formulas for example the total amount of items sold for the specific day. So where to right formulas and how to use them should be learned.

2.Track personal loan will take a little knowledge about the tool and again here also a little amount of formulas can be used and thus will need a little knowledge that where to write them but will need less knowledge than first one.

3.Evaluation of commitments will need a very low knowledge about tool and can be used easily.

4. Track a project It also need a little knowledge about the tool and will need least knowledge if compared with other options.

6 0
3 years ago
Two forms of compression are lossy and lossless. State giving reasons which
Helen [10]

Answer:

(i) When transmitting a draft manuscript for a book, the lossless compression technique is most suitable because after decompression, the data is rebuilt and restored in its form as it was from where it originated

(ii) When transmitting a video recording which you have made of the school play, a lossy compression technique is most suitable because the large size of video files require the increased data carrying capacity which is provided by the lossy transmission technique. The quality of the video can be reduced without affecting the message intended to be delivered

Explanation:

4 0
3 years ago
# 12/9/2020
EastWind [94]

where it says   " def main() " there needs to be something in the "()"

Hope this helps.   : )

3 0
3 years ago
You can sort data in a table or_____?<br><br><br> A. Report<br> B. Form<br> C. Field<br> D. Record
Mazyrski [523]

Answer:I believe its form

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • 1. Which of the following are considered CAD powerhouses?
    6·1 answer
  • For the following array x [10] = { 45, 20, 50, 30, 80, 10, 60, 70, 40, 90} show the contents of x after the function call split
    6·1 answer
  • Cuales Son las características de la máquina analítica de Carlos Babbage ?
    11·1 answer
  • COMPUTER ORGANIZATION &amp; ARCHITECTURE I question 3<br> need correct the answers to all
    12·1 answer
  • Know when the double, int, String, and char data types are best used. Example: I would store a social security number in a strin
    7·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    5·1 answer
  • William found out that someone used his report on american culture without his permission. what is william a victim of?
    11·1 answer
  • 16. Which of the following wire gage sizes is the thickest? A. 14 B. 8 C. 0 D. -33
    14·1 answer
  • Express 0.0005 x 10-4 farads as picofarads
    5·2 answers
  • Which of the following refers to a collection of colors, fonts, and effects that can be
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!