return the first count multiples of number in desc order in a list.
e.g call with input (3,2) returns [6,3]
call with input(5,3) returns [15,10, 5]
plz help me with this
how can i do it using map()??
3 Years
Discussion Span
Last Post by woooee

Have a look at the range(start, stop[, step]) function (Click Here ) from python. Also, you can use it to generate reverse lists:
Resource - click me

Regarding your usage of the map(function, iterable) function: it applies a function to the iterable agrument, so you'll need some elements on which to apply the function.

Since you're using Python, you can introduce also a lambda function. For example (pseudo-code):

# map definition - map (function, iterable)

function input (number, multiplier) 
    iterable := reverse_range (multiplier, 0)
    l := list_of ( map ( lambda mult: number * mult, iterable) )
    return l

But again, if it's not mandatory to use the map function, you can easily generate this using only the range function (hint - make use of the optional step argument, which can be also negative).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.