*args practice question
Hi I am stuck on a what feels like a simple practice Python question. I think I solved it in multiple ways but the system is still not passing me so I must be missing something. Could use a hand. Thank you! Question: *args The given code defined a function called my_min(), which takes two arguments and returns the smaller one. You need to improve the function, so that it can take any number of variables, so that the function call works. Remember, *args can be accessed inside the function as a tuple. starter code: def my_min(x, y): if x < y: return x else: return y print(my_min(8, 13, 4, 42, 120, 7)) My Solution 1: def my_min(x, *args): for y in args: if x < y: print(x) else: print(y) my_min(8, 13, 4, 42, 120, 7) My Solution 2: def my_min(x, *args): result = [] for y in args: if x < y: result.append(x) else: result.append(y) return result print(my_min(8, 13, 4, 42, 120, 7)) My Solution 3: def my_min(x, *y): result = "" for num in y: if x < num: result += str(x) else: result += str(num) return result print(my_min(8, 13, 4, 42, 120, 7))