Question: The following Python program swaps two variables which is entered by user # To take input from the user x = input ('Enter value

The following Python program swaps two variables which is entered by user 

The following Python program swaps two variables which is entered by user # To take input from the user x = input ('Enter value of x: ') y = input ('Enter value of y: ') # create a temporary variable and swap the values temp = x x = y y = temp print ('The value of x after swapping: ',x)) print ('The value of y after swapping: ',y)) Based on the code given above, re-write it to perform swapping only when x>y, otherwise do nothing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Take input from the user x intinputEnter value of x y ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!