Performing basic arithmetic on two given numbers

Report a typo

You are given a simple Python program that contains two variables, `x` and `y`, whose values are 10 and 20 respectively. The program performs various arithmetic operations (addition, subtraction, multiplication, and division) on these two variables and formats these results into a string that's then printed to the console. The lines of this code have been scrambled, and your task is to reorder them so that the correct sequence of operations is performed, and the correct output is displayed following the pattern: 'Sum: , Difference: , Multiplication: , Division: '.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                x = 10
              
                mul_result = x * y
              
                print(output)
              
                sum_result = x + y
              
                output = "Sum: {}, Difference: {}, Multiplication: {}, Division: {}".format(sum_result, diff_result, mul_result, div_result)
              
                y = 20
              
                div_result = x / y
              
                diff_result = x - y
              

Create a free account to access the full topic