Error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error?

What is the output of this code? def func(named args,*args): print (named_args) return *args func(1,2,3,4,5) Output : error Why error?

12th Jul 2019, 11:01 AM
Airat Abdrakov 🎸
Airat Abdrakov 🎸 - avatar
4 Answers
+ 9
The special symbols are not allowed in declaring the name of a variable
12th Jul 2019, 11:18 AM
Muaz Ahmad
Muaz Ahmad - avatar
+ 4
As AM!N mentioned there must be no space in a variable name. The other issue is the return statement. see the code that is working here: def func(named_args,*args): print (named_args) print(*args) # test only return args print(func(1,2,3,4,5)) # output: 1 2 3 4 5 (2, 3, 4, 5)
12th Jul 2019, 4:50 PM
Lothar
Lothar - avatar
+ 3
It should be def func(named_args... There should be _ not space between named and args
12th Jul 2019, 11:15 AM
ΛM!N
ΛM!N - avatar
0
Да я бля понял, заебали, просто в глаза долблюсь, задания ебанутые пошли на внимательность
12th Jul 2019, 7:26 PM
Airat Abdrakov 🎸
Airat Abdrakov 🎸 - avatar