Respuesta :
Answer:
Following are the code to this question:
import math# import math module
def RaiseToPower(): # defining a function RaiseToPower
r= math.pow(2,1/12) # defining r variable that calcualte the decimal point value.
return r # return r variable value.
f0= float(input()) #defining f0 variable that hold input frequency .
for n in range(0,5):#defining for loop to count all frequency
fn = f * math.pow(RaiseToPower(),n) # defining fn variable that calls method RaiseToPower and multiply the value by frequency
print(fn,end=' ') # use print method to prints all five frequency
Output:
440
440.0 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537443
Explanation:
Description of the above python code can be defined as follows:
- In the above code first we import the package of the math module for converting frequency, after importing package a "RaiseToPower" method is declared, inside the method r variable is declared, that counts decimal value and return its value.
- In the next step, "f0" a frequency variable is declared that input a value from the user and defined a for loop to in the loop fn variable declared, calls the method and pass its input value and stores its decimal points and at the last print its value.
The piano frequency.
As per the question, the piano and musical instrument have a key with a frequency of f0 and each white and black that are higher and lower keys are at a frequency of f0 * r^n. The n is the distance number of keys that are given in the piano with the keys of r is 2^(1/12).
Thus the answer is import math module.
- The initial keys are given for the frequency output having the next 4 higher key frequencies. If the input is 440 the A key in the piano ad the output keyboard is 440.
- The def r(): # defining a function Raise To Power r= math.pow(2,1/12) # defining r variable that calculate the decimal point value.
- return r # return r variable value. f0= float(input()) #defining f0 variable that hold input frequency .
- for n in range(0,5):#defining for loop for counting all frequency fn = f * math.pow (Raise To Power(),n) use print method to prints all five frequency The frequency output: 440.0 466.1637615180899.
Learn more about the on a piano.
brainly.com/question/20750313.