You are not logged in. Please login at www.codechef.com to post your questions!

×

Whats map in python 3.5?

What is map in python 3.5?

asked 12 Jun '18, 01:25

mdrzwan12's gravatar image

1★mdrzwan12
-31
accept rate: 0%


dict is like map . It is a hashtable rather than a b-tree

link

answered 12 Jun '18, 01:33

ssp547's gravatar image

3★ssp547
3077
accept rate: 25%

$\texttt{map(f,A)}$ is a function that applies a function $\texttt{f}$ to a list $\texttt{A}$. For example you might see people do input reading by $\texttt{map(int,input().split())}$. Note that this is the alternative to using $\texttt{[int(x) for x in input().split()]}$.

There is actually a small difference between the two expressions. $\texttt{[int(x) for x in input().split()]}$ returns a list while $\texttt{map(int,input().split())}$ returns a generator, to make them equivalent do $\texttt{list(map(int,input().split()))}$.

Some examples of using map together with some other related functions.

link

answered 12 Jun '18, 03:53

gorre_morre's gravatar image

7★gorre_morre
964210
accept rate: 42%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×671

question asked: 12 Jun '18, 01:25

question was seen: 127 times

last updated: 12 Jun '18, 03:53