Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

8 bytes added, 10:33, 16 June 2017
PART 4 - List Comprehension
l1
l2
</source>The '''map()''' function can be used to apply a function on each item in a list. This is exactly what happened in the previous example; however, using the ''map()'' function provides for better syntax, and removes the loop (including the variable that was created inside the loop). Therefore, using the ''map()'' function will make your Python script more efficient while performing the same task.<br><br>
:#To demonstrate, issue the following:<source>
def square(number):
13,420
edits