Oct-20-2019, 01:10 PM
(Oct-18-2019, 12:29 PM)perfringo Wrote:>>> x, y = 7, 42 >>> name_x_as_string = f'{x=}'.split('=')[0] >>> name_y_as_string = f'{y=}'.split('=')[0] >>> f'The length of {name_x_as_string}{name_y_as_string} is {x + y}' 'The length of xy is 49'
It might be something like this.
But still I need it to be in function. I want to call the function with variables like this:
def length(x,y): name_x_as_string = f'{x=}'.split('=')[0] name_y_as_string = f'{y=}'.split('=')[0] print(f'The length of {name_x_as_string}{name_y_as_string} is {x + y}') a=5 b=3 length(a,b)The result here is:
The length of xy is 8It's not what I need. The result should be:
The length of ab is 8Is it understandable?