0

Tuple into a list

How can I return a list in a function with *arg. Appreciate quick help as in middle of practice

20th May 2021, 7:50 AM
Karamveer
Karamveer - avatar
4 Antworten
+ 4
Simply pass the <args> as argument to `list()` function then return the resulting list from the function. def fun( *args ): return list( args ) print( fun( 2021, 5, 20 ) )
20th May 2021, 8:51 AM
Ipang
+ 2
You mean return a list from a function which accepts *arg as argument? or did you mean something else?
20th May 2021, 8:13 AM
Ipang
0
Returning a list from a function which accepts *args as argument
20th May 2021, 8:47 AM
Karamveer
Karamveer - avatar
0
list() can converting tuple to list
20th May 2021, 4:15 PM
Isabella
Isabella - avatar