syntax list comprehension python code example
Example 1: list comprehensions
h_letters = [ letter for letter in 'human' ]
print( h_letters)
Example 2: python list comprehension
nums = [3578, 6859, 35689, 268]
half_of_nums = [x/2 for x in nums]
h_letters = [ letter for letter in 'human' ]
print( h_letters)
nums = [3578, 6859, 35689, 268]
half_of_nums = [x/2 for x in nums]