TECH PIXEL

"Tech Pixel": Clearly mentions the site name. "Your go-to source for the latest tech news, reviews, and tutorials": Summarizes what the site offers. "Stay updated with the newest trends in technology": Highlights the value of staying current with tech trends. "Enhance your skills with our expert guides": Emphasizes the practical benefits and expertise available on the site.

PYTHON EXERCISE SOLUTION

 

#SOLO LEARN EXE

*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.

SOLUTION:

def my_min(x, y, *args):
       return min (args)
       if x < y:
           return x
       else:
           return y
print(my_min( 8, 13, 4, 42, 120, 7))

Post a Comment

0 Comments