Question

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

  1. 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. The quotient should be the
      # whole number, not the decimal number: for example, with the
      # original values of dividend and divisor (7 and 3), your code
      # should print 2, then 1: 3 goes into 7 two whole times, with
      # one left over.
      #
      # Print the quotient and remainder each on their own line.
      # Both values should be integers: there should be no decimals.
      
      # Add your code here!
  2. Create a new program in Mu and save it as ps2.4.2.py

    • Take the code below and fix it as indicated in the comments:

    • meal_cost = 10.00
      tax_rate = 0.08
      tip_rate = 0.20
      
      # You may modify the lines of code above, but don't move them!
      # Your code should work with different values for the variables.
      
      # When eating at a restaurant in the United States, it's
      # customary to have two percentage-based surcharges added on
      # top of your bill: sales tax and tip. These percentages are
      # both applies to the original cost of the meal. For example,
      # a 10.00 meal with 8% sales tax and 20% tip would add 0.80
      # for tax (0.08 * 10.00) and 2.00 for tip (0.20 * 10.00).
      #
      # The variables above create the cost of a meal and identify
      # what percentage should be charged for tax and tip.
      #
      # Add some code below that will print the "receipt" for a
      # meal purchase. The receipt should look like this:
      #
      # Subtotal: 10.00
      # Tax: 0.8
      # Tip: 2.0
      # Total: 12.8
      #
      # Subtotal is the original value of meal_cost, tax is the
      # tax rate times the meal cost, tip is the tip rate times
      # the meal cost, and total is the sum of all three numbers.
      # Don't worry about the number of decimal places; it's fine
      # if your code leaves off some numbers (like 0.8 for tax) or
      # includes too many decimal places (like 2.121212121 for tip).
      
      #Add your code here!
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================

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. The quotient should be the
# whole number, not the decimal number: for example, with the
# original values of dividend and divisor (7 and 3), your code
# should print 2, then 1: 3 goes into 7 two whole times, with
# one left over.
#
# Print the quotient and remainder each on their own line.
# Both values should be integers: there should be no decimals.

# Add your code here!
print('Quotient:',dividend//divisor)
print('Remainder:',dividend%divisor)

=============================================================

#Add your code here!
print('Subtotal: {:.2f}'.format(meal_cost))
print('Tax: {:.1f}'.format(meal_cost*tax_rate))
print('Tip: {:.1f}'.format(meal_cost*tip_rate))
print('Total: {:.1f}'.format(meal_cost+(meal_cost*tax_rate)+(meal_cost*tip_rate)))

=============================================================

1: Proj 1 meal_cost = 10.00 tax rate = 0.08 tip_rate = 0.20 3 5 # You may modify the lines of code above, but dont move them

Add a comment
Know the answer?
Add Answer to:
Create a new program in Mu and save it as ps2.4.1.py Take the code below and...
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.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.3.3.py and take the code below...

    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...

  • 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.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 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 ps3.4.3.py and take the code below...

    Create a new program in Mu and save it as ps3.4.3.py and take the code below and fix it as indicated in the comments: # Consult this blood pressures chart: http://bit.ly/2CloACs # # Write a function called check_blood_pressure that takes two # parameters: a systolic blood pressure and a diastolic blood # pressure, in that order. Your function should return "Low", # "Ideal", "Pre-high", or "High" -- whichever corresponds to # the given systolic and diastolic blood pressure. # #...

  • 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.5.3.py and take the code below...

    Create a new program in Mu and save it as ps4.5.3.py and take the code below and fix it as indicated in the comments: # In the Pokemon video game series, every Pokemon has six # stats: HP, Attack, Defense, Special Attack, Special Defense, # and Speed. # # Write a function called total_stats that will take as input # a list of dictionaries. Each dictionary will have seven # key-value pairs: # # - name: a Pokemon's name #...

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