+ 1
Wht is the error in this program pl help me to solve this
def my(l) l = l + l return () mylist = [31,24,75] my(mylist)
4 Answers
+ 3
Check your duplicate question :P
0
Assuming you want to print out the list twice in a single list, the code should be:
def my(l):
l = l + l
return l
mylist = [31,24,75]
print(my(mylist))
1. You need a colon (:) when defining functions.
2. Indentations for lines 2 and 3
3. Tell Python what to return (which I assume is l)
4. When returning a value, Python will not print the result. You have to deliberately tell Python to print it. Which, again, I'm assuming you want to print it.
0
thank you sooo much
0
def mystery(l):
l = l + l
return()
my list = [ 31,24,75]
mystery (my list)
what will b output for this