samedi 27 juin 2015

Need help on programming . Beginner Python

Sound level L in units of decibel (dB) is determined by L = 20 log10(p/p0) where p is the sound pressure of the sound (in Pascals, abbreviated Pa), and p0 is a reference sound pressure equal to 20 × 10–6 Pa (where L is 0 dB).

The following table gives descriptions for certain sound levels. Threshold of pain 130 dB Possible hearing damage 120 dB Jack hammer at 1 m 100 dB Traffic on a busy roadway at 10 m 90 dB Normal conversation 60 dB Calm library 30 dB Light leaf rustling 0 dB Write a program that reads a value and a unit, either dB or Pa, and then prints the closest description from the list above.

L=input('What can you hear outside')
L=L.upper()
if L == "JACKHAMMER":
   print(L)
from math import *
Pa=2
Pa=(Pa)
p0=(20*10)**(-6)(2)
p0=round(p0)
LdB = 20(log(Pa/p0)) 

so far i have this but there is an error

Aucun commentaire:

Enregistrer un commentaire