Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

complete the program as follows: 1. read sound_power and distance_trave…

Question

complete the program as follows:

  1. read sound_power and distance_traveled from input as floats, respectively.
  2. compute sound_intensity using the formula $sound_intensity = \frac{sound_power}{(4.0 * \pi * distance_traveled^2)}$
  3. output \sound wave intensity is \ followed by the value of sound_intensity to three digits after the decimal point.

ex: if the input is:
10.0
9.0
then the output is:
sound wave intensity is 0.010
note:

  • use math.pi for $\pi$.
  • $distance_traveled^2$ can be computed using *.

import math

Explanation:

Step1: Read input values

Read sound_power and distance_traveled as floats:

sound_power = float(input())
distance_traveled = float(input())

Step2: Calculate sound intensity

Use the given formula with math.pi:

sound_intensity = sound_power / (4.0 * math.pi * distance_traveled * distance_traveled)

Step3: Format and print output

Print the result rounded to 3 decimal places:

print(f"Sound wave intensity is {sound_intensity:.3f}")

Answer:

import math

sound_power = float(input())
distance_traveled = float(input())
sound_intensity = sound_power / (4.0 * math.pi * distance_traveled * distance_traveled)
print(f"Sound wave intensity is {sound_intensity:.3f}")