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
grin007 [14]
3 years ago
13

For question 2 you will need to write your own Python code. Think through the problem, and re-read if necessary. Determine how y

ou might solve the problem logically. Think of what variables you might need to store temporary values. Your friend was bragging about how many stairs he climbed each day because of his apartment location on the fifth floor. Calculate how many times your friend would have to go down then back up the stairs to reach his fifth floor apartment to reach 100, 500, 1000 and 5000 steps. The apartments all have vaulted ceilings, so use 16 steps per floor in your calculations. Remember to count down and back up as one trip. You will also reuse the variable that contains the target number of steps. Round up. HINT: take a look at previous question, and the use of import math and math.ceil(). Recommended variable names you will need for this question: steps_per_floor, floor, target_steps, trips >>>: Write a program that calculates the total number of trips given 100, 500, 1000 or 5000 daily steps, 16 steps per floor, and down and back up the stairs represents one trip. Re-use the target_steps variable. Round the number of trips up to the nearest whole integer. >>>: Display the number of trips for each of the four step counts, using the following example, illustrating the output for 100 steps. Add the other three results below the 100 steps result.
Computers and Technology
1 answer:
user100 [1]3 years ago
7 0

Answer:

It has to be performed a minimum of  1  trips to do   100 steps

It has to be performed a minimum of  4  trips to do   500 steps

It has to be performed a minimum of  7  trips to do   1000 steps

It has to be performed a minimum of  32  trips to do   5000 steps

All trips need to be  44

Explanation:

open python console and execute the .py code bellow:

import math

floor_steps=16

floor=5

total=0

target_steps=2*floor_steps*floor

trips=100/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   100 steps")

trips=500/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   500 steps")

trips=1000/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   1000 steps")

trips=5000/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   5000 steps")

print("All trips need to be ",total)

You might be interested in
How long does a seller have to ship an item on offerup
ra1l [238]

They have up to six days to ship the item after it has been purchased via either the Buy Now option or them accepting an offer.

7 0
2 years ago
Write a statement that calls a function named IncreaseItemQty, passing the variable addStock. Assign mugInfo with the value retu
PolarNik [594]

Answer:

Explanation:

#include <stdio.h>

#include <string.h>

typedef struct ProductInfo_struct {

char itemName[30];

int itemQty;

} ProductInfo;

ProductInfo IncreaseItemQty (ProductInfo productToStock, int increaseValue) {

productToStock.itemQty = productToStock.itemQty + increaseValue;

return productToStock;

}

int main(void) {

ProductInfo mugInfo;

int addStock;

addStock = 10;

scanf("%s", mugInfo.itemName);

scanf("%d", &mugInfo.itemQty);

**** /* Your solution goes here */ ****

printf("Name: %s, stock: %d\n", mugInfo.itemName, mugInfo.itemQty);

return 0;

}

8 0
3 years ago
Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant.
max2010maxim [7]

Complete Question:

Python Programming: Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant and repeats if the user enters "y" or "Y" to continue.

Print the name of the application "Tip Calculator"

- Get input from the user for "Cost of meal: "

- Calculate and display the "Tip Amount" and "Total Amount" at a tip_percent of 15%, 20%, and 25%.

- Use a FOR loop to iterate through the tip_percent

- The formula for calculating the tip amount is: tip = cost of meal * (tip percent / 100)

- The program should accept decimal entries like 52.31. Assume the user will enter valid data.

- The program should round the results to a maximum of two decimal places . At the "Continue? (y/n)" prompt, the program should continue only if the user enters “y” or “Y” to continue.

- Print "Bye!" or a salutation at the end of the program

Answer:

Answered in Python

print("Tip Calculator")

tryagain = "y"

while tryagain == "y" or tryagain == "Y":

    amount = float(input("Cost of Meal: "))

    for tip_percent in range(15,26,5):

         print(str(tip_percent)+"%")

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

    tryagain = input("Continue?y/n: ")

print("Bye!")

Explanation:

This prints the name of the calculator

print("Tip Calculator")

This initializes tryagain to yes

tryagain = "y"

While tryagain is yes, the following loop is repeated

while tryagain == "y" or tryagain == "Y":

This prompts user for amount of meal

    amount = float(input("Cost of Meal: "))

This gets the tip_percent which is 15%, 20% and 25% respectively

    for tip_percent in range(15,26,5):

This prints the tip_percent

         print(str(tip_percent)+"%")

This calculates and prints the tip amount rounded to 2 decimal places

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

This calculates and prints the total amount rounded to 2 decimal places

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

This prompts user to continue or not

    tryagain = input("Continue?y/n: ")

The program ends here

print("Bye!")

7 0
3 years ago
Which of the following is generally true about Open Source Software?
JulijaS [17]
<span>Open source software is usually free to download and install, and it can be studied, changed, and distributed according to the rights of the software. I don't believe there is any copyright laws on this type of software. The most known open source software is Linux and it's available for most operating systems right now. Typically, open source owners just ask for donations for their work.</span>
3 0
4 years ago
A _____ is a collection of binary digits, including message data and control characters for formatting and transmitting, sent fr
Keith_Richards [23]

Answer:

Packet

Explanation:

8 0
3 years ago
Other questions:
  • What is revision
    13·2 answers
  • Edhesive assignment 4 student schedule python
    10·2 answers
  • Which type of computing refers to firms purchasing computing power from remote providers and paying only for the computing power
    7·1 answer
  • What features of a credit card do you need to research when considering a credit card?
    7·2 answers
  • Mention any six profession related to tourism
    6·2 answers
  • After a robbery, what is the purpose of conducting a neighborhood canvass?
    9·1 answer
  • Arrange the following units of storage in descending<br> order. B, TB,KB, GB,MB
    5·1 answer
  • You would use the _______ conditional formatting options when analyzing a worksheet in which you want to highlight the highest o
    13·1 answer
  • Which phrases from the two selections MOST help the reader define the meaning of "captivity"?
    11·2 answers
  • It is impossible to overemphasize the fact that, from the perspective of a computer, a network is a) simply another I/O device.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!