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
Like this:
Like Loading...