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
Write a recursive method called lengthOfLongestSubsequence(a, b) that calculates the length of the longest common subsequence (l
kompoz [17]

Answer:

Explanation:

The following code is written in Java and creates the recursive function to find the longest common substring as requested.

 static int lengthOfLongestSubsequence(String X, String Y) {

       int m = X.length();

       int n = Y.length();

       if (m == 0 || n == 0) {

           return 0;

       }

       if (X.charAt(m - 1) == Y.charAt(n - 1)) {

           return 1 + lengthOfLongestSubsequence(X, Y);

       } else {

           return Math.max(lengthOfLongestSubsequence(X, Y),

                   lengthOfLongestSubsequence(X, Y));

       }

   }

4 0
3 years ago
Brook is designing a database that customers can use to find their ideal vacation spot. If they only want to see beach vacations
Aleksandr [31]

Answer:

filter the data

Explanation:

its like when you filter a search on y o u t u b e and say u search among us u can filter and say live vids or channel's

7 0
2 years ago
Read 2 more answers
What are the preset formulas in a spreadsheet called?
Oksanka [162]
They are called functions on a spreadsheet.
5 0
3 years ago
Read 2 more answers
A semiconductor kit is used on a
iragen [17]

The correct answer is PSC motor.

If you need more help, you can check on quizlet, I learnt about ecd from there lol

5 0
3 years ago
How do i answer a qestion on brainly
viva [34]

Answer:

Click on an answer, then click "Add Answer +(?)"

Explanation:

This way you'll be able to add a question to any brainly question that you are able to add a question to. Such as this one. You will receive half the points that the person asking the question assigned to the question, with the minimum being 10 points. After this you will receive those points and be able to write a response much like this one allowing you and 1 other person to answer the same question and received thanks and or brainliest by which the user asking the question can give out to the person who they believe gave the best answer.

Hope this helps! <3

5 0
2 years ago
Other questions:
  • You have implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts acces
    7·1 answer
  • In Microsoft Word you can access the _______ command from the "Mini toolbar
    11·1 answer
  • A ____ is a text document written in HTML.
    13·1 answer
  • Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their chec
    9·2 answers
  • Difference between positional and non positional number​
    12·1 answer
  • If there is only a stop sign posted at a railroad
    9·1 answer
  • A cycle merchant allows 15% discount on the marked price of a bicycle and still he makes a profit
    14·1 answer
  • With a(n) ______, a search engine will show ads that have the keyword typed exactly as the searcher used, but may also have othe
    6·1 answer
  • I’ll give brainliest if answers are correct
    11·1 answer
  • 2. The On and Off states are represented by _____________ class 7 number system​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!