Code that I wrote:
def ball(f):
py_ball = f * 5
u_ball = py_ball / 10
return py_ball, u_ball
print("py ball: {}, u ball: {}".format(ball(100)))
When I use str.format, it throws an exception:
Traceback (most recent call last):
File "rear.py", line 5, in
print("py ball: {}, u ball: {}".format(ball(100)))
IndexError: tuple index out of range
But if I use % formatting:
print("py ball: %d, u ball: %d" % ball(100))
it works just fine and produces:
py ball: 500, u ball: 50
*ball(100)to unpack the returned values - Ma0