Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (List() # Create a new instance of moka.List
- .extend(range(1,20)) # Insert the numbers from 1 to 20
- .keep(lambda x: x > 5) # Keep only the numbers bigger than 5
- .rem(operator.gt, 7) # Remove the numbers bigger than 7 using partial application
- .rem(eq=6) # Remove the number 6 using the 'operator shortcut'
- .map(str) # Call str on each numbers (Creating a list of string)
- .invoke('zfill', 3) # Call zfill(x, 3) on each string (Filling some 0 on the left)
- .insert(0, 'I am') # Insert the string 'I am' at the head of the list
- .join(' ')) # Joining every string of the list and separate them with a space.
- # 'I am 007'
Advertisement
Add Comment
Please, Sign In to add comment