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
Edhesive 8.5 code Practice help me pls
Hoochie [10]

Answer:

twainQuotes = ['I have never let my schooling interfere with my education.', 'Get your facts first, and then you can distort them as much as you please.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.', "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]

print(twainQuotes)

twainQuotes.sort()

print(twainQuotes)

twainQuotes.insert(1,'Courage is resistance to fear, mastery of fear, not absence of fear.' )

print(twainQuotes)

Explanation:

ok

3 0
2 years ago
A car with a 20-gallon gas tank averages 23.5 miles per gallon when driven in town and 28.9 miles per gallon when driven on the
katovenus [111]
Highway: 
<span>cout << "The car can drive " << 20*26.8 << " miles on the highway." << endl; </span>
<span>Town: </span>
<span>cout << "The car can drive " << 20*21.5 << " miles in the town." << endl;</span>
5 0
2 years ago
Give me 5 examples of Cyber Security
Vera_Pavlovna [14]

Answer:

Firewalls, Antiviruses, Malware, Antispyware,

Explanation:

8 0
2 years ago
: Describe the type of gameplay seen during early video games (ex. Spacewar!, Pong).
Alexeev081 [22]

Answer:

Computer scientists began building rudimentary games and simulations on mainframe computers in the 1950s and 1960s, with MIT's Spacewar! in 1962 being one of the first such games to be played with a video display. The first consumer-ready video game hardware arrived in the early 1970s, with the Magnavox Odyssey, the first home video game system, and the first arcade video games from Atari, Computer Space and Pong, the latter of which was later transformed into a home console version. Pong's success in arcades and at home prompted numerous firms to create clones of the game, resulting in a market contraction in 1978 owing to oversaturation and a lack of innovation.

8 0
2 years ago
A program has a infinite while loop. How can you interrupt it?
MrRa [10]

Answer:

The <em>break</em> keyword is how you interrupt a while loop.

the syntax looks like this ↓

Python ↓

while <em>true</em>:

<em>break</em>

Java script ↓

while (<em>true</em>);

<em>break</em>

6 0
2 years ago
Other questions:
  • ‘Bottom of the pyramid’ innovation refers to ancient Egyptian approaches to new product development – true or false?
    8·1 answer
  • Brute force attacks involve identifying a valid user account and then bombarding the server with an extensive:
    13·1 answer
  • An optimal solution to a linear programming problem MUST lie A. somewere on the line between two corner points. B. somewhere out
    12·1 answer
  • Company-wide systems that connect one or more local area networks (LANs) or wide area networks (WANs) are called _____. a) legac
    15·1 answer
  • What do you call the physical, touchable, materials parts of a computer system?
    7·1 answer
  • Favorite color should it be stored why?or why not?<br>​
    6·1 answer
  • 2 Write<br>a program to and area of<br>4<br>walls. A = 2h (l+b)​
    6·1 answer
  • Many digital libraries have much more information than traditional libraries
    13·1 answer
  • which of the following is the most appropriate way to write css style for the font family property in html
    8·1 answer
  • Say true or false
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!