Five numbers are given below. Keeping them in that same order, compute a single result with Python addition, multiplication, subtraction, and division, respectively.
Put another way--add the first and second numbers, multiply the second and third numbers, subtract the third and fourth numbers, and divide the fourth and fifth numbers. Don't use any parentheses; let order of operations take care of things. Do this in a single statement, and store the result in the result
variable below.
In [ ]:
n1 = 0.4589
n2 = 13
n3 = -59
n4 = 8.43333333
n5 = 2.1
result = -1
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
import numpy as np
np.testing.assert_allclose(result, -770.5569730142857)
In [ ]:
n1 = 0.4589
n2 = 13
n3 = -59
n4 = 8.43333333
n5 = 2.1
result = -1
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
import numpy as np
np.testing.assert_allclose(result, -432.1802333119699)
In [ ]:
n1 = 0.4589
n2 = 13
n3 = -59
n4 = 8.43333333
n5 = 2.1
result = -1
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
assert result == -435.5
In [ ]:
n1 = 20344983945038.48374839
n2 = 984374.783894273
quotient = -1
remainder = -1
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
import numpy as np
np.testing.assert_allclose(quotient, 20667924.735487375)
np.testing.assert_allclose(remainder, 723995.2262485754)