Computer Science, asked by vectors8504, 11 months ago

Write a python program to find the maximum number of people at the base level such that the total weight of tower does not exceed the maximum weight limit of the stage.


rakeshchennupati143: you have to explain it clearly so that reader can understand what should he/she have to code
rakeshchennupati143: post a new question explaining in detail about your question, and comment here if you have posted your question so that i can answer ASAP

Answers

Answered by QGP
0

A Python Program

Our strategy would be to first take in the average weight of the person, then the weight of the tower and finally the weight limit of the stage.

I am assuming that the stage is already holding the tower. So, subtract the tower weight from the weight limit. The remaining is the weight that can be taken up by people. Divide this by the average weight of a person to calculate the number of people that can stand at the base level. Also, since we cannot have fractional answers, convert the final result to int.

Here goes the program, with screenshots of the code as well as Runtime implementation.

\rule{320}{1}

# A python program to find the maximum number of people  

# at the base level such that the total weight of tower  

# does not exceed the maximum weight limit of the stage.

# Input the average weight of a person

average_weight_of_person = float(input("Enter the average weight of a person: "))

# Input the weight of tower without any people at base level

tower_weight = float(input("Enter the weight of the tower: "))

# Input the weight limit of the stage

stage_weight_limit = float(input("Enter the maximum weight that the stage can hold: "))

# Now, we subtract the tower weight from the weight limit first.

# Then, divide the result by the average weight of a person.

# Convert this to int, since we cannot have fractional people.

max_number_of_people = int((stage_weight_limit - tower_weight) / average_weight_of_person)

# Print the result.

print(f"The maximum number of people at the base level is {max_number_of_people}.")

Attachments:
Similar questions