Question

In: Computer Science

PYTHON PROBLEM: Goal: Design and implement a Python program to solve the following problem. Scientists measure...

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.

Solutions

Expert Solution

#*********************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:)


Related Solutions

Write a complete and syntactically correct Python program to solve the following problem: Write a program...
Write a complete and syntactically correct Python program to solve the following problem: Write a program for your professor that allows him to keep a record of the students’ average grade in his class. The program must be written in accordance with the following specs: 1. The input must be interactive from the keyboard. You will take input for 12 students. 2. You will input the students’ name and an average grade. The student cannot enter an average below zero...
Design and implement a program in python that takes a list of items along with quantities...
Design and implement a program in python that takes a list of items along with quantities or weights. The program should include at least two function definition that is called within the main part of your program. Each item has a price associated by quantity or weight. The user enters the item along with the quantity or weight and the program prints out a table for each item along with the quantity/weight and total price. Your program should be able...
Write a complete and syntactically correct Python program to solve the following problem: You are the...
Write a complete and syntactically correct Python program to solve the following problem: You are the payroll manager for SoftwarePirates Inc. You have been charged with writing a package that calculates the monthly paycheck for the salespeople. Salespeople at SoftwarePirates get paid a base salary of $2000 per month. Beyond the base salary, each salesperson earns commission on the following scale: Sales Commission Rate Bonus <$10000 0% 0 $10000 – $100,000 2% 0 $100,001 - $500,000 15% $1000 $500,001 -...
Write a Python program in a file called consonants.py, to solve the following problem using a...
Write a Python program in a file called consonants.py, to solve the following problem using a nested loop. For each input word, replace each consonant in the word with a question mark (?). Your program should print the original word and a count of the number of consonants replaced. Assume that the number of words to be processed is not known, hence a sentinel value (maybe "zzz") should be used. Sample input/output: Please enter a word or zzz to quit:...
Design and implement a Python program which will allow two players to play the game of...
Design and implement a Python program which will allow two players to play the game of Tic-Tac-Toe in a 4x4 grid! X | O | X | O -------------- O | O | X | O -------------- X | X | O | X -------------- X | X | O | X The rules for this game is the same as the classic, 3x3, game – Each cell can hold one of the following three strings: "X", "O", or "...
Question(on Python). There is a Python program what could solve the simple slide puzzles problem by...
Question(on Python). There is a Python program what could solve the simple slide puzzles problem by A* algorithm. Please fill in the body of the a_star() function. In order to solve a specific problem, the a_star function needs to know the problem's start state, the desired goal state, and a function that expands a given node. To be precise, this function receives as its input the current state and the goal state and returns a list of pairs of the...
IN PYTHON Write a program to do the following: Solve the a set of equations as...
IN PYTHON Write a program to do the following: Solve the a set of equations as mentioned in "Zybook 5.20 LAB: Brute force equation solver". Instead of the arithmetic operators use your own function defined in a module named calc. You must provide two files (calc.py, brute_force_solver.py) :- 1) calc.py:- Add function named 'add' instead of using operator '+' [10pts] Add function named 'difference' instead of using operator '-' [10pts] Add function named 'product' instead of using operator '*' [10pts]...
PYTHON ONLY NO JAVA! PLEASE INCLUDE PSEUDOCODE AS WELL! Program 4: Design (pseudocode) and implement (source...
PYTHON ONLY NO JAVA! PLEASE INCLUDE PSEUDOCODE AS WELL! Program 4: Design (pseudocode) and implement (source code) a program (name it LargestOccurenceCount) that read from the user positive non-zero integer values, finds the largest value, and counts it occurrences. Assume that the input ends with number 0 (as sentinel value to stop the loop). The program should ignore any negative input and should continue to read user inputs until 0 is entered. The program should display the largest value and...
Write a Python program to solve the 8-puzzle problem (and its natural generalizations) using the A*...
Write a Python program to solve the 8-puzzle problem (and its natural generalizations) using the A* search algorithm. The problem. The 8-puzzle problem is a puzzle invented and popularized by Noyes Palmer Chapman in the 1870s. It is played on a 3-by-3 grid with 8 square blocks labeled 1 through 8 and a blank square. Your goal is to rearrange the blocks so that they are in order, using as few moves as possible. You are permitted to slide blocks...
Python: Implement a grid-maze solving program that uses depth-first search to solve grids. The agent’s actions...
Python: Implement a grid-maze solving program that uses depth-first search to solve grids. The agent’s actions are moving in one of four directions: up, down, left, and right. A grid is formatted like below where 1’s represent locations the agent cannot traverse: 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT