Wht is the error in this program pl help me to solve this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)

5th Feb 2017, 2:43 AM
kavitha.k
4 Answers
+ 3
Check your duplicate question :P
5th Feb 2017, 8:55 AM
visph
visph - avatar
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.
5th Feb 2017, 3:15 AM
blackcat1111
blackcat1111 - avatar
0
thank you sooo much
5th Feb 2017, 3:17 AM
kavitha.k
0
def mystery(l): l = l + l return() my list = [ 31,24,75] mystery (my list) what will b output for this
5th Feb 2017, 3:23 AM
kavitha.k