@Pranav - you code show basic confusion about use of function arguments.
Your functions take arguments, but in 2 out of 3 cases you are not using them properly.
Look at function Creat. It takes argument l (by the way poor choice of name for couple of reasons, but I will come to that at the end of my post). Then in the function body you don't use that l, you simply overvrite it in the list comprehension. When you call the function on line 18, you just pass empty list. The function will work all the same without any arguments.
Now, about other problems in your code
Your functions take arguments, but in 2 out of 3 cases you are not using them properly.
Look at function Creat. It takes argument l (by the way poor choice of name for couple of reasons, but I will come to that at the end of my post). Then in the function body you don't use that l, you simply overvrite it in the list comprehension. When you call the function on line 18, you just pass empty list. The function will work all the same without any arguments.
def Creat(): print("First value is a string then three comma separated integers\n") my_list =[str(x) for x in input().split(",")] return my_listor even
def Creat(): return [str(x) for x in input("First value is a string then three comma separated integers\n").split(",")]same apply to argument d in your other function. In it however the use of
l
is correct - you pass argument and use it in the function.Now, about other problems in your code
- Don't use single letter names. Descriptive names are your friend and make it easier to maintain code in long-term.
- If you use single letter for some reason, avoid names like
l
(lowercase L), o (lowercase O). It's difficult to distinguish lowercase L and 1 (one). Also lowercase O and zero. You can see it's difficult to tell if it isll
orl1
- Avoid having multiple statements separated by ;. It's uncommon in python although syntax is valid.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs