Question

Create a new program in Mu and save it as ps3.3.3.py and take the code below...

  1. Create a new program in Mu and save it as ps3.3.3.py and take the code below and fix it as indicated in the comments:

    mystery_int = 46
    
    # You may modify the lines of code above, but don't move them!
    # When you Submit your code, it should work with
    # different values for the variables.
    
    # Use a while loop to create a countdown from mystery_int to
    # 0. Count down by 3s: if mystery_int is 46, then you should
    # print 46, 43, 40, etc. Do not print any number lower than 0.
    # Note that you should print both the original value of
    # mystery_int and 0 if you land on it exactly.
    
    # Add your code here!
  2. Create a new program in Mu and save it as ps3.3.4.py and take the code below and fix it as indicated in the comments:

    beats_per_measure = 4
    measures = 5
    
    # You may modify the lines of code above, but don't move them!
    # When you Submit your code, it should work with
    # different values for the variables.
    
    # We want to print out beats based on measures and beats per measure 
    # (like when count as you tap your foot to the music).
    # In that exercise, you printing out 1 through the number of beats
    # in a measure over and over depending on the number of measures.
    # With the above settings, for example, you should print: 
    # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 (with each
    # number on its own line)
    #
    # Once you get that, you should replace the number 1 with the 
    # number of the current measure. So, the first number in each measure 
    # will always rise.
    # For example, instead of 1 2 3 4 1 2 3 4 1 2 3 4 (with each
    # number on its own line), you'd now print 1 2 3 4 2 2 3 4 3 2 3 4,
    # and so on.
    #
    # HINT: One approach would involve adding a conditional.
    
    # Add your code here!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

Sample Output:

Rawcode:

mystery_int=46
while(mystery_int >=0):       #while loop
   print(mystery_int,end=" ")   #end=" " for printing in one line
   mystery_int=mystery_int-3   #decrementing mystery_int by 3

-------------------------------------

2)

Sample Output:

RawCode:

beats_per_measure = 4       #variables
measures = 5
for i in range(1,measures+1):   #for loop
   print(i,end=" ")       #here i indicates the measure of no of current measures
   for j in range(2,beats_per_measure+1):
       print(j,end=" ")

--------------------------------------------------------

Hope you understand If you have any doubts comment me.Upvote me.

Add a comment
Know the answer?
Add Answer to:
Create a new program in Mu and save it as ps3.3.3.py and take the code below...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a new program in Mu and save it as ps3.3.1.py and take the code below...

    Create a new program in Mu and save it as ps3.3.1.py and take the code below and fix it as indicated in the comments: mystery_int = 50 # You may modify the lines of code above, but don't move them! # When you Submit your code, it should work with # different values for the variables. # Write a for loop that prints every third number from 1 to # mystery_int inclusive (meaning that if mystery_int is 7, it #...

  • Create a new program in Mu and save it as ps2.4.1.py Take the code below and...

    Create a new program in Mu and save it as ps2.4.1.py Take the code below and fix it as indicated in the comments: dividend = 7 divisor = 3 # You may modify the lines of code above, but don't move them! # Your code should work with different values for the variables. # The variables above create a dividend and a divisor. Add # some code below that will print the quotient and remainder # of performing this operation....

  • Create a new program in Mu and save it as ps2.4.3.py Take the code below and...

    Create a new program in Mu and save it as ps2.4.3.py Take the code below and fix it as indicated in the comments: Level = 50 Attack = 125 Defense = 110 Power = 60 Modifier = 1 # You may modify the lines of code above, but don't move them! # Your code should work with different values for the variables. # In the Pokemon game franchise, damage is calculated using this formula found here: # https://bulbapedia.bulbagarden.net/wiki/Damage # #...

  • Create a new program in Mu and save it as ps3.2.2.py and take the code below...

    Create a new program in Mu and save it as ps3.2.2.py and take the code below and fix it as indicated in the comments: egg = True milk = True butter = True flour = True # You may modify the lines of code above, but don't move them! # When you Submit your code, we'll change these lines to # assign different values to the variables. # Imagine you're deciding what you want to cook. The boolean # variables...

  • Create a new program in Mu and save it as ps2.3.3.py Take the code below and...

    Create a new program in Mu and save it as ps2.3.3.py Take the code below and fix it as indicated in the comments: busy = True hungry = False tired = True stressed = False # You may modify the lines of code above, but don't move them! # Your code should work with different values for the variables. # Logical operators get more complex when we start using them # with the results of other logical operators. So, let's...

  • Create a new program in Mu and save it as ps3.4.1.py and take the code below...

    Create a new program in Mu and save it as ps3.4.1.py and take the code below and fix it as indicated in the comments: # Write a function called hide_and_seek. The function should # have no parameters and return no value; instead, when # called, it should just print the numbers from 1 through 10, # follow by the text "Ready or not, here I come!". Each # number and the message at the end should be on its own...

  • Create a new program in Mu and save it as ps3.2.1.py and take the code below...

    Create a new program in Mu and save it as ps3.2.1.py and take the code below and fix it as indicated in the comments: hour = 3 minute = 45 # You may modify the lines of code above, but don't move them! # When you Submit your code, we'll change these lines to # assign different values to the variables. # Around Georgia Tech, there are plenty of places to get a # late night bite to eat. However,...

  • Create a new program in Mu and save it as ps4.4.1.py and take the code below...

    Create a new program in Mu and save it as ps4.4.1.py and take the code below and fix it as indicated in the comments: # Write a function called "save_leaderboard" that accepts a # single list of tuples as a parameter. The tuples are of the # form (leader_name, score) # The function should open a file called "leaderboard.txt", # and write each of the tuples in the list to a line in the file. # The name and score...

  • Create a new program in Mu and save it as ps4.2.1.py and take the code below...

    Create a new program in Mu and save it as ps4.2.1.py and take the code below and fix it as indicated in the comments: # Write function called third_character that accepts a # string as an argument and returns the third character # of the string. If the user inputs a string with fewer than # 3 characters, return "Too short". # Write your function here! # Below are some lines of code that will test your function. # You...

  • Create a new program in Mu and save it as ps4.3.3.py and take the code below...

    Create a new program in Mu and save it as ps4.3.3.py and take the code below and fix it as indicated in the comments: # Imagine you're writing some code for an exercise tracker. # The tracker measures heart rate, and should display the # average heart rate from an exercise session. # # However, the tracker doesn't automatically know when the # exercise session began. It assumes the session starts the # first time it sees a heart rate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT