Python Programming Tutorial – 50 – map

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

Kartheyan Sivalingam says:

list comprehension is a sensible alternative to map() new_list = [func(x) for x in someList]

naif abdul khader says:

how to write this same code with “for” command??… pls let me know quickly

Isaac says:

why not:
new_income = [double_money(i) for i in income]

Dk02 says:

I like ur voice lol

Eyal Pery says:

Let’s use Lambda 🙂

print(list(map(lambda x: x*2, [10,30,75])))

Enock Kwesi Addey says:

Sweet!

Rambrus0 says:

i dont understand what does this.

Kalaivany Sivalingam says:

Further topics you could cover:
-Regular Expressions
-Networking
-CGI Programming
-Database Interactions
-optparse
-Generators
-Iterators
-List comprehension
-Decorators (Including standard decorators built into Python, e.g @staticmethod)
-super() function
-enumerate() function
-sockets
-C extensions
-Templates
-Other modules part of Python’s standard library (hashlib, pickle etc)

Third party libraries you could teach:
-Twisted (Event driven networking library)
-Django (Web framework – like Flask, but better imo)

Good luck! Most of these topics lack good videos, so it would be great if you could cover them

Jack Scott says:

Is anyone having issues with importing AF_PACKET from sockets? PyCharm isn’t recognizing it for me.

n Wood says:

I played with the above in idle, it seems that you don’t need list in front of the map function, as map will return a list eg
>>> income=[10,20,30]
>>> def d(d):
return d*2

>>> ans=map(d,income)
>>> type(ans)

>>> ans
[20, 40, 60]
>>>

DavidAnatolie says:

I wrote a lambda function instead of defining one.

Batman says:

or you can do something like this:

nub=[45,23,23,89,456,789,123,890]

def magic_number(number):
magic= number*2+10/2
print(magic)

list(map(magic_number,nub))

salsa4u says:

why does it double the income if the double is in the double money function, I dont understand the logic?

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!