Python: Advanced Topics in python


Good Afternoon Friends,I am confused by this challenge
I don't understand why does the list consists of zero.


the list doesn't consists of zeroes?


This is the ouput shown in my window

[0, 3, 6, 9, 12, 15]


a list consisting of zeroes would be:

[0, 0, 0, 0, 0]

list comprehension is just a for loop inside a list. Think about a loop, where you append numbers divisible by 3 to the list


Can you explain me what is the logic used in the next challenge
I am completely befuddled by this lambda thing.Thank you very much in advance


lambda is just a single line function. See if you can find the similarities between normal functions and lambdas


I tried to make a normal function to compare with lambda. Can you please check

def lang(list):
    for i in languages:
        if i=="Python":
            print i
print lang(languages)


def lang(lst):
    result = []
    for i in lst:
        if i=="Python":
    return result
print lang(languages)

i think this is closer. or somethingl ike this:

def lang(lst):
    for i in lst:
        if i !="Python":
    return lst
print lang(languages)

not sure which mimics lambda better


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.