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
Pepsi [2]
3 years ago
6

Given that note, write a program which tells us the major scale starting at that note, using the pattern above. In the main bloc

k: Use a while loop to continue to ask for notes and then call a function get_scale. In the function get_scale, output the scale using the list. A hint is that you can encode the number of steps as a separate list of offsets. (Since a major scale will always have the same offs
Computers and Technology
1 answer:
White raven [17]3 years ago
5 0

<u>Solution and Explanation:</u>

the_notes = ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B'] #original list

def get_scale(choice): #function to get the major diatonic scale

steps=[1,1,.5,1,1,1,.5] #separate list for steps

size=None

for i in range(0,12): #loop to find out the index of the note entered

if(the_notes[i]==choice):

size =i

break

new_notes=the_notes[size:] + the_notes[:size]

#the above statement rotate the list so that the entered note can become the first note in the new list(i.e new notes)

index =0 #

scale="" #a string to store the major diatonic scale

for i in range(0,7):

scale+=new_notes[index]+" "

if(steps[i]==1):

index = index+2

else:

index=index+1

return scale

#main block

while(1):

choice=input("What scale do you want or Q to quit? ")

if(choice=='Q'):

break

elif(choice in the_notes):

print(get_scale(choice))

else:

print("That is not a note")

You might be interested in
Non-preemptive Shortest Job First (SJF) scheduling policy is not optimal if:
ivann1987 [24]

Answer:

The answer is A

Explanation:

Basically, Shortest job first (SJF) is a scheduling policy that selects jobs on queue for execution  within a short execution time.

From the definition of SJF above, it means that there are a lot of process on queue and the (SJF) job is to receive processes on queue to execute within a short execution time.

Therefore, if all the jobs or process arrives at the SJF at the same time, the SJF will forfeit one of its major purpose which is scheduling of jobs.

That will therefore not make Non-preemptive Shortest Job First (SJF) not function at its optimal point.

4 0
3 years ago
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
Colt1911 [192]

Answer:

True: In binary search algorithm, we follow the below steps sequentially:

Input: A sorted array  B[1,2,...n] of n items and one item x to be searched.

Output: The index of x in B if exists in B, 0 otherwise.

  1. low=1
  2. high=n
  3. while( low < high )
  4.  {      mid=low + (high-low)/2
  5.         if( B[mid]==x)
  6.          {
  7.             return(mid)  //returns mid as the index of x
  8.           }
  9.          else
  10.          {
  11.              if( B[mid] < x)      //takes only right half of the array
  12.               {
  13.                 low=mid+1
  14.               }
  15.              else               // takes only the left half of the array
  16.               {
  17.                high=mid-1
  18.               }
  19.           }
  20.  }
  21. return( 0 )

Explanation:

For each iteration the line number 11 or line number 15 will be executed.

Both lines, cut the array size to half of it and takes as the input for next iteration.

6 0
4 years ago
What is the purpose of a turbine in a power plant?
anastassius [24]
C. To make the generator work

4 0
3 years ago
What is an example of a free online library?
ivanzaharov [21]
The answer is b
Hope it helps



6 0
3 years ago
Read 2 more answers
Page scaling mode helps increase or reduce the size of the worksheet to fit within the set number of pages to be printed. Which
Sever21 [200]
Answer is Scale to fit group

You can set the maximum number of pages in an excel worksheet to fit within. You have an option of choosing to re-scale either vertically, horizontally, or both. You re-scale in order to make you worksheet fit within a set number of pages.



8 0
4 years ago
Read 2 more answers
Other questions:
  • What is the most common threat on the internet? auction fraud illegal software computer viruses hackers?
    14·1 answer
  • Which of the following actions would help people determine their interests?
    11·1 answer
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • Consider the eight bit signed binary number 1110 0101. Convert it to signed decimal from assuming the signed binary number is re
    5·1 answer
  • What is the name of the device that senses the current flowing, tripping the circuit, and cutting off the electricity?
    13·1 answer
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    8·2 answers
  • How do u reverse image search on Android? ​
    9·1 answer
  • In a new worksheet, you must start by typing in cell A1.
    11·1 answer
  • Explanation historical development of computer ​
    10·1 answer
  • Before the 20th century how did most people experience computing​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!