Academy for Academic Education

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
Exit mobile version