1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ostrovityanka [42]
3 years ago
15

Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a li

st comprehension(c) a map().List would look something like ['Wallstreet','Gambler','Parents'] but of course using each tool as listed:segments = [{'name': 'Wallstreet', 'average_spend': 82.01}, {'name': 'Gambler', 'average_spend': 107.00}, {'name': 'Parents', 'average_spend': 10.52}]
Computers and Technology
1 answer:
Alchen [17]3 years ago
7 0

Answer:

new_segment = [ ]

for segment in segments:

   new_segment.append({'name': segment, 'average_spend': money})

print( new_segment)

Using list comprehension:

new_segment =[{'name': segment, 'average_spend': money}  for segment in segments]

Using map():

def listing(a):

   contain =  {'name': segment, 'average_spend': money}

   return contain

new_segment = [ ]

new_segment.append(map( listing, segment))

print(list(new_segment)

Explanation:

The python codes above create a list of dictionaries in all instances using for loop, for loop in list comprehension and the map function which collect two arguments .

You might be interested in
Which feature of a blog marks a unique link to each post through which it can be recalled anytime?
astra-53 [7]
The awnser would be a permalink
5 0
4 years ago
Read 2 more answers
Raman will perform in pune tomorrow(simple past)​
Ilya [14]

Answer:

Raman performed in Pune yesterday

6 0
3 years ago
Read 2 more answers
the header, in an academic report, typically contains the author’s name and the current page number true or false
kolbaska11 [484]
TRUE

True


In most academic reports, most specifically, an MLA academic report, Student’s last name and current page number is contained in the headers. In MLA, which is most common used formatting guide in academic reports, headers numbers all pages consecutively within the right margin.


6 0
3 years ago
What is computer hardware / software​
Pavel [41]

Answer: <u>Computer hardware is any physical device used in or with your machine, like for example, a mouse, or a keyboard.</u> Computer software is a collection of programming code installed on your computer's hard drive it can process billions of data and inputs through this.

Hope this helps!

5 0
3 years ago
1 2
sweet [91]

Answer:

Both modules can generate random numbers.

Explanation:

Both the random and secrete modules are builtin programming modules used for generating random number variables. The random module consists of a number of methods in its module for random. number generation such as seed() ; getstate() ; random() ; choice() ; randrange() ; randint() and so on. Random methids are best for generating random numbers which are to be adopted for simulation or modeling. The secrete modules does the same however, numbers generated are stronger and less predictable than the random number modules. Secrete modules are usually adopted in the generation of authentication token and security pins.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Very often in data science, we are interested in understanding how values change with time. Use np.diff and np.max (or just max)
    13·1 answer
  • Let's say you're creating a search stream in your hootsuite dashboard, to find mentions of the phrase vacation holiday getaway.
    15·1 answer
  • How has the internet of things impacted buisness?
    15·1 answer
  • In Excel, an individual cell is the intersection of a row and a column.<br> True<br> False
    10·2 answers
  • Lionel wants to find images of colonies of Emperor penguins to use for a school project. Which of the following phrases should h
    15·1 answer
  • Want to be friends on my switch? here :)! friend code: SW-5635-3847-1397​
    13·2 answers
  • Write pseudocode for a function that translates a telephone number with letters in it (such as 1-800-FLOWERS) into the actual ph
    11·1 answer
  • Does anyone know the name of the font :) ?
    14·2 answers
  • John's father specifically asked him to get a magnetic disk from the store in his neighborhood. What should John buy?
    5·1 answer
  • In 1956, the unit byte was coined by American statistician and computer scientist John Tukey
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!