Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
The program below contains a mathematical expression that relies on default operator precedence to produce an answer (54.5). We...Question
The program below contains a mathematical expression that relies on default operator precedence to produce an answer (54.5). We would like to get a different answer (30.0) by adding parentheses to change the order of evaluation. Complete the following steps
Add parentheses so the addition operation happens firs
Add parentheses so the subtraction operation happens next
The following example demonstrates the expected program output.
30.0
print(5+10*5-1/2)
Add parentheses so the addition operation happens firs
Add parentheses so the subtraction operation happens next
The following example demonstrates the expected program output.
30.0
print(5+10*5-1/2)
Answers
Answered by
GPT 3.5
print(((5+10)*5)-(1/2))