Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3.3.8 (EtellaeJ0ul oding Problem BeatsandMeasures2.py 1 beats per measure 4 2 me

ID: 3920720 • Letter: 3

Question

3.3.8 (EtellaeJ0ul oding Problem BeatsandMeasures2.py 1 beats per measure 4 2 measures 5 4:#10u may modify the lines of code above, but don't move them! 5 When you Submit your code, we'11 change these lines to 6 assign different values to the variables. 8 #Aecall our earlier problem where you printed out beats based n measures and beats per measure (3.3.5 Coding Exercise 1) In that exercise, you printing out 1 through the number of beats 10. 11 fin a meas 12 | # ure over and over depending on the number of measures. 13 #Copy and modify your code, but this time, you should replace the 14. #number 1 with the number.of the current measure. So, the first 15 #number in each measure will always rise. 16 # 17 #For example, instead of 1 2 3 4 1 2 3 4 1 2 3 4 (with each 18 #number on its own line), you'd now print 1 2 3 4 2 2 3 4 3 2 3 4, 19 #and so on. 20 # 21 #10u can use our sample answer from that problem if you'd prefer. 22 # 23 #HINT: One approach would involve adding a conditional. 24 25 26 Add your code here! Using the original values of the variables 27 #above, this will initially print the following numbers (but each 28 on their own line): 29 #1 2 3 4 2 2 3 4 3 2 3 4 4 2 3 4 5 2 3 4 30 31

Explanation / Answer

beats_per_measure = 4 measures = 5 for i in range(1, measures+1): for j in range(1, beats_per_measure+1): if j == 1: print(i, end=' ') else: print(j, end=' ') print()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote