Python Classroom Series – 06/Oct/2020

List Comprehensions

  • Lets try to solve Project Euler Problem 1 Refer Here
  • syntax:
new_list = [ expression for member in iterable ]
new_list = [ expression for member in iterable (if conditional) ]
  • Refer Here for list comprehension based solution for project euler problem 1

Anonymous functions: Lambda

  • In python anonymous function is function that is defined without name. for normal functions we use def keyword & for anonymous functions we use the lambda key word
  • syntax:
lambda arguments: expression
  • Refer Here for example with lambda and comprehensions

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin