class Calculator: # Type your code here. if __name__ == "__main__": calc = Calculator(); num1 = float(input()) num2 = float(input()) # 1. The initial value print('{:.1f}'.format(calc.get_value())) # 2. The The value after adding num1 calc.add(num1) print('{:.1f}'.format(calc.get_value())) # 3. The value after multiplying by 3 calc.multiply(3) print('{:.1f}'.format(calc.get_value())) # 4. The value after subtracting num2 calc.subtract(num2) print('{:.1f}'.format(calc.get_value())) # 5. The value after dividing by 2 calc.divide(2) print('{:.1f}'.format(calc.get_value())) # 6. The value after calling the clear() method calc.clear() print('{:.1f}'.format(calc.get_value()))
class Calculator:
# Type your code here.
if __name__ == "__main__":
calc = Calculator();
num1 = float(input())
num2 = float(input())
# 1. The initial value
print('{:.1f}'.format(calc.get_value()))
# 2. The The value after adding num1
calc.add(num1)
print('{:.1f}'.format(calc.get_value()))
# 3. The value after multiplying by 3
calc.multiply(3)
print('{:.1f}'.format(calc.get_value()))
# 4. The value after subtracting num2
calc.subtract(num2)
print('{:.1f}'.format(calc.get_value()))
# 5. The value after dividing by 2
calc.divide(2)
print('{:.1f}'.format(calc.get_value()))
# 6. The value after calling the clear() method
calc.clear()
print('{:.1f}'.format(calc.get_value()))
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images