Question: Python simple value function swap for intro to computer science class. Please help! I'm stuck. :( def swap_value(a, b): 04. Swapping values: does this

Python simple value function swap for intro to computer science class. Please help! I'm stuck. :( def swap_value(a, b): """  04. Swapping values: does this work for the know data types?  Finish this swap_values function.  This function takes two arguments and swap their values.  The input value, a and b may have same or different data types, including int, float, string or bool.  This function does not have explicit return values.  Hint: you may need a third variable to help you when swapping the values.  Hint: you should find swapping values with a function call does not work.  """  print("Add your solution here") 
# tests for Q4 int_a = 2018 float_a = 10.50 swap_value(int_a, float_a) print("After calling swap_value function, int_a is {}, float_a is {}".format(int_a,float_a)) string_a = "hello world" swap_value(string_a, float_a) print("After calling swap_value function, string_a is {}, float_a is {}".format(string_a,float_a)) print("--"*20) 

****I tried inserting:

temp_variable = a a = b b = temp_variable 

under the print function, but it didn't work.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!