In: Computer Science
PYTHON PROBLEM:
Goal: Design and implement a Python program to solve the following problem.
Scientists measure an object’s mass in kilograms and weight in newtons. If you know the amount of mass of an object in kilograms, you can calculate its weight in newtons with the following
formula:
[Note: Use or test any random numbers to check whether the weight is heavy, can be lifted or light]
????h? = ???? × 9.8
Write a program that asks the user to enter an object’s mass in kilograms, then calculates its weight in newtons. If the object weighs more than 980 newtons, the program should display the following message
The object is too heavy to be lifted
obviously indicating that it is too heavy to be lifted; otherwise, it should display the message
The object can be lifted
with the obvious meaning. If the object weighs less than 98 newtons, the program must display the following additional message
The object is quite light
1. Write the pseudocode for solving the problem.
2. Write the Python program.
#*********************main.py************************/
mass = float(input("Enter an object’s mass in kilograms: "))
weight = mass * 9.8
if(weight>980):
print("The object is too heavy to be lifted")
elif(weight<98):
print("The object is quite light")
else :
print("The object can be lifted")
Pseudocode:
Begin
input mass of object as mass
calculate weight = mass * 9.8
if weight>980 then
print "The object is too heavy to be lifted"
else if weight<98 then
print "The object is quite light"
else
print "The object can be lifted"
End
Please let me know if you have any doubt or modify the answer, Thanks:)