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
Travka [436]
3 years ago
7

SUMMING THE TRIPLES OF THE EVEN INTEGERS FROM 2 THROUGH 10) Starting with a list containing 1 through 10, use filter, map and su

m to calculate the total of the triples of the even integers from 2 through 10. Reimplement your code with list comprehensions rather than filter and map.
Computers and Technology
1 answer:
hichkok12 [17]3 years ago
8 0

Answer:

numbers=list(range(1,11)) #creating the list

even_numbers=list(filter(lambda x: x%2==0, numbers)) #filtering out the even numbers using filter()

triples=list(map(lambda x:x*3 ,even_numbers)) #calculating the triples of each even number using map

total_triples=sum(triples) #calculatting the sum

numbers=list(range(1,11)) #creating the list

even_numbers=[x for x in numbers if x%2==0] #filtering out the even numbers using list comprehension

triples=[x*3 for x in even_numbers] #calculating the triples of each even number using list comprehension

total_triples=sum(triples) #calculating the sum.

Explanation:

Go to the page where you are going to write the code, name the file as 1.py, and copy and paste the following code;

numbers=list(range(1,11)) #creating the list

even_numbers=list(filter(lambda x: x%2==0, numbers)) #filtering out the even numbers using filter()

triples=list(map(lambda x:x*3 ,even_numbers)) #calculating the triples of each even number using map

total_triples=sum(triples) #calculatting the sum

numbers=list(range(1,11)) #creating the list

even_numbers=[x for x in numbers if x%2==0] #filtering out the even numbers using list comprehension

triples=[x*3 for x in even_numbers] #calculating the triples of each even number using list comprehension

total_triples=sum(triples) #calculating the sum

You might be interested in
What does the word “Gacha” come from??????
natka813 [3]

Answer:

The word gacha is derived from "gachapon", Japanese vending machines that dispense plastic capsules containing toys, which are still hugely popular in Japan today. Gachapon is the satisfying sound the machine makes when a player spins a gacha and receives a toy.

Explanation:

3 0
3 years ago
Read 2 more answers
Which of the following occupations is the most likely o require working weekends and night shifts
Juliette [100K]
What are the choices?
5 0
3 years ago
Read 2 more answers
You can use this area to create your resume.
Svetach [21]

Answer:

what area?

Explanation:

if you need help creating a resume lmk :)

all you really need is

your skill set

-what you're good at

-what you can do

-what are you certified at like

excel, Microsoft office etc.

let me know and I'll send an example

3 0
3 years ago
Pls Help A table is a_______of rows and columns that provides a structure for presenting data​
WARRIOR [948]

Answer:

Graph or chart???

Explanation:

5 0
2 years ago
What does remedy mean
Serggg [28]
Remedy means a Medicine or treatment for an injury.
Hope it helps!
4 0
3 years ago
Read 2 more answers
Other questions:
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • Sheila is using a process of saving files to her desktop and then renaming them. She is
    13·2 answers
  • What is wrong with the following code? How should it be fixed?
    12·1 answer
  • How to find determinant of ​
    15·1 answer
  • I need help with writing the code in Python that draws an arrow pointing to the right.
    15·1 answer
  • Colin Mackay Inc., a software company with its head office in Amsterdam, has employees across three continents. Certain project
    11·1 answer
  • Write a program to calculate the farthest in each direction that Gracie was located throughout her travels. Add four print state
    10·1 answer
  • Take a minute to reflect on your thoughts and learning so far and discuss:
    13·1 answer
  • Help! ASAP! 1 Question.........°○°​
    11·1 answer
  • (Java)
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!