On a piano, each key has a frequency, and each subsequent key (black or white) is a known amount higher. Ex: The A key above middle C key has a frequency of 440 Hz. Each subsequent key (black or white) has a frequency of 440 * rn, where n is the number of keys from that A key, and r is 2(1/12). Given an initial frequency, output that frequency and the next 3 higher key frequencies. If the input is 440, the output is: 440 493.883 523.251 554.365.Note: Include one statement to compute r = 2(1/12) using the pow function, then use r in the formula fn = f0 * rn. (You'll have three statements using that formula, different only in the value for n).

Answers

Answer 1
Answer:

Answer:

sample output

Enter f0 = 440

440.0,466.1637615180899, 493.8833012561241,

523.2511306011974,  554.3652619537443

Explanation:

import math                                 // math library  

def RaiseToPower():                 //  RaiseToPower method

 r = math.pow(2,1/12)               //r = 2^(1/12)

f0 = float(input('Enter f0 : '))     //input from user

                                               

//a key has a frequency,sy f0

                                                                                                                                     

print(f0,end=' ')                      //Display statement

 for n in range(1,5):                //Iterate the loop up to  the next 4 higher key Hz

n = f0 * math.pow(r,n)         //calculate the fn value

print(fn,end=' ')                   //Display statement

 RaiseToPower()                //Call RaiseToPower method  

                                         

 

         

     

       


Related Questions

This quiz is meant to test your understanding of secure passwords. Click on the title and answer the following questions in the submission box: What are the characteristics of a secure password? Why is phishing harmful?
Python code 100 Random Numbers (twice)python codeinstructions:You need to write code that will print two bricks of numbers, one with integers, one with decimals.
Using your choice of pseudocode, C# or java, define a class for a Pig. A Pig object should have three attributes: a name, an age, and weight. Your class should have (i) a constructor that takes three arguments and copies them to the attributes; (ii) setters (mutators) and getter accessors) or properties (C#) for the attributes; (iii) a display method to display the Pig's attributes on screen; and (iv) a main() method that creates a Pig object, assigns values to its attributes, and displays them by calling the display method.
Subtract (100000)2 from (111)2 using 1s and 2s complement method of subtraction​
How will you ensure that all of the network's applications and tcp/ip services also support ipv6?

Develop a program that asks the user to enter a capital for a U.S. state. Upon receiving the user input, the program reports whether the user input is correct. For this application, the 50 states and their capitals are stored in a two-dimensional array in order by state name. Display the current contents of the array then use a bubble sort to sort the content by capital. Next, prompt the user to enter answers for all the state capitals and then display the total correct count. The user's answer is not case-sensitive.

Answers

Answer:try redoing everything step by step and see if that solves it

Explanation:

Write a program using integers user_num and x as input, and output user_num divided by x three times.Ex: If the input is:20002Then the output is:1000 500 250Note: In Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded).LAB ACTIVITY2.29.1: LAB: Divide by x0 / 10main.pyLoad default template...12''' Type your code here. '''

Answers

Answer:

Following are the code to the given question:

user_num = int(input())#defining a variable user_num that takes input from user-end

x = int(input())#defining a variable x that takes input from user-end

for j in range(3):#defining for loop that divides the value three times

   user_num = user_num // x#dividing the value and store integer part

   print(user_num)#print value

Output:

2000

2

1000

500

250

Explanation:

In the above-given program code two-variable "user_num and x" is declared that inputs the value from the user-end and define a for loop that uses the "j" variable with the range method.

In the loop, it divides the "user_num" value with the "x" value and holds the integer part in the "user_num" variable, and prints its value.  

. How are returnspredicted in modern microprocessors?

Answers

Answer:

Return are predicted in the modern microprocessor as, branch predictor is the modern method for the processor for the prediction. The basic function of the branch predictor is improving in the pipeline instruction. It is basically the important part for implement the execution and the pipe lining. And the return predicted uses the call by reference technique for the data in instruction.

create a Java program that prompt the user to enter a number of hours, wages, over time factor, then your program should calculate the employee total wages. Make sure your program can calculate the over time and regular wages if number of hours are great than 40 hours. Use 1.5 for over time factor. Make sure your Java code has comments showing declarations and description of your variables.

Answers

Answer:

The program to the given question as follows:

Program:

import java.util.*; //import package for user input.

public class Main //defining class Main

{

public static void main(String[] as) //defining main method

{

final double over_time_factor = 1.5; //define final variable

double number_Of_hours,wages,total_Wages=0; //defining variables  

System.out.println("Enter hours and wages rate:"); //print message

Scanner obc = new Scanner(System.in); //creating Scanner class object for user input

number_Of_hours = obc.nextDouble(); //taking input

wages = obc.nextDouble(); //taking input

if(number_Of_hours>40) //check condition if number_Of_hours greter then 40

{

total_Wages=40*wages+(number_Of_hours-40)*wages*over_time_factor; //calculate value

}

else //else part

{

total_Wages = number_Of_hours*wages; //calculate total_Wages

}

System.out.println("Total Wages: $"+total_Wages); //print value

}

}

Output:

Enter hours and wages rate:

12

3

Total Wages: $36.0

Explanation:

In the above java program, the package is first imported into the user input and then the class is defined and inside this, the main method is defined, that defines a double type final variable "over_time_factor" is defined that holds a value "1.5", Then double type variable is defined that are " number_Of_hours, wages, and total_Wages", in which first two variables are used for taking input from the user and the third variable is used to calculate their values. After taken input from the user, the conditional statement is used that can be defined as follows:

  • The if block, checks the variable "number_Of_hours" value is greater than 40 it will calculate over_time_factor value that is held by total_Wages variable.  
  • In else block, it will multiply the user input value that is store in total_Wages variable.  
  • At the end of the conditional statement, the print function is used that prints total_Wages variable value.  

You are experiencing issues when trying to transfer files between two computers using FTP. What could be the potential cause(s) of the issue

Answers

A potential cause of this issue with FTP is that the server is not able to resolve the client IP address.

What is FTP?

FTP is an acronym for file transfer protocol and it can be defined as a type of server that is designed and developed to store and provide files for download and sharing between two or more users on a computer system.

In this scenario, the user is most likely experiencing issues when trying to transfer files through the file transfer protocol (FTP) because the server is not able to resolve the client IP address, which is the address of the recipient of the file.

Read more on FTP here: brainly.com/question/20602197

A proper divisor of a positive integer $n$ is a positive integer $d < n$ such that $d$ divides $n$ evenly, or alternatively if $n$ is a multiple of $d$. For example, the proper divisors of 12 are 1, 2, 3, 4, and 6, but not 12. A positive integer $n$ is called double-perfect if the sum of its proper divisors equals $2n$. For example, 120 is double-perfect (and in fact is the smallest double-perfect number) because its proper divisors are 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, and 60, and their sum is 240, which is twice 120. There is only one other 3-digit double-perfect number. Write a Python program to find it, and enter the number as your answer below.

Answers

Answer:

The program written in Python is as follows:

See Explanation section for line by line explanation

for n in range(100,1000):

     isum = 0

     for d in range(1,n):

           if n%d == 0:

                 isum += d

     if isum == n * 2:

           print(n)

Explanation:

The program only considers 3 digit numbers. hence the range of n is from 100 to 999

for n in range(100,1000):

This line initializes sum to 0

     isum = 0

This line is an iteration that stands as the divisor

     for d in range(1,n):

This line checks if a number, d can evenly divide n

           if n%d == 0:

If yes, the sum is updated

                 isum += d

This line checks if the current number n is a double-perfect number

     if isum == n * 2:

If yes, n is printed

           print(n)

When the program is run, the displayed output is 120 and 672