Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

FIND OUT THE ERROR AND CORRECT IT PLEASE THANK YOU IN PYTHON Statement: Users will provide several numbers. We will add the 1st, subtract the

FIND OUT THE ERROR AND CORRECT IT PLEASE THANK YOU IN PYTHON

image text in transcribed

Statement: Users will provide several numbers. We will add the 1st, subtract the 2nd, add the 3rd and so on. This process will continue, until the user has put a blank line as an input (mentioned in the prelab report). Sample input: Please enter a number: 24 Please enter a number: 5 Please enter a number: 1 Please enter a number: 10 Please enter a number: 36 Please enter a number: 67 Please enter a number: Sample output: The result is = -21 The above output is obtained from 24 -5 +1 -10 + 36 - 67 = -21 Hints: Instead of just adding or subtracting the numbers (which can get complicated), why not multiply every 2nd number by -1 and then add it.] Below is the python code. sign = -1 S = input("Please enter a number: ") while s == "" sign = sign total = sign*temp s = input("Please enter a number: ") print("The result is: %d", total)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions