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
Komok [63]
3 years ago
9

Write a function square_evens(values) that takes a list of integers called values, and that modifies the list so that all of its

even elements are replaced with their squares, but all of its odd elements are left unchanged.
Computers and Technology
1 answer:
Mice21 [21]3 years ago
5 0

Answer:

#create the function

def square_evens(values):

   count_Value = 0

   #loop loop for iteration

   for i in values:

       #check for even number

       if (i) % 2 == 0:

           values[count_Value] = i * i  #store the square in the same index

       count_Value =count_Value + 1

   print(values)  #print the list

# list of integers

values = [1, 2, 3, 4, 5, 6]

#calling the function

square_evens(values)

Explanation:

The above code is written in python. first, create the function square_evens() which takes one parameter of the list.

inside the function declare the variable and then take a for loop for traversing each element in the list. Inside the for loop, we take the if-else statement for checking the number is even. if the number is even then stored the square of that value in the same list. To store the square value in the same index, we take the count variable for tracking the index.

After the all element in the list checked, the program terminates the loop and then print the updated list on the screen.

Outside the function, create the list with an integer value and then calling the function with passing the list argument.  

NOTE: In the python programming, please keep the indentation in code.

You might be interested in
Auditors often make use of computer programs that perform routine processing functions, such as sorting and merging. These progr
ohaa [14]

Answer:

UTILITY PROGRAM

Explanation:

Utility program are program that perform routine processing function such as sorting and merging. They are often used by auditors to performs a very specific task, usually related to managing system resources. It contain a number of utilities for managing disk drives, printers, and other devices.

Utility program also performs specific task related to the management of computer functions, resources, password protection, memory management, virus protection, and file compression.

5 0
4 years ago
Complete the rest of this statement:
Radda [10]

Answer:

Computer science is about how computers work, in terms of programming, design and data processing.

Explanation:

Computer science is a discipline that studies issues related to information technology and its use, including the storage, processing, presentation, and transfer of information.

The fringes of computer science extend to many other sciences: for example, usability research is closely related to psychology and bioinformatics to biology, among others. Digital media research, on the other hand, has links to media science and communications research. Computer science also has a strong interaction with computational science and information society research examining the wider effects of data processing in different areas.

4 0
3 years ago
Can anyone answer this ​
Ivenika [448]

Answer:

I dont see the question

Explanation:

7 0
3 years ago
Hi, please help me, please help me.​
goblinko [34]
My day has been good
hope this helps
3 0
3 years ago
Steve is conducting research on the reach of mental health care to the youth. After gathering data on psychologists, he creates
lora16 [44]

Answer:

Descriptive Statistics.

Explanation:

First Steve gathered the data and after that he created the pie chart displaying the percentage of psychologists working in different fields.Here Steve used descriptive statistics to display the data that he collected.

Descriptive statistics are the descriptive coefficients that give the abstract of the data collected.

6 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell all words correctly.
    14·1 answer
  • Alice is working on a web page to attract the maximum number of people to join her cause. She wants to inform people about the b
    10·2 answers
  • Which of the follow represents a form of disruptive technology? Tend to open new markets and destroy old ones A new way of doing
    11·1 answer
  • A computer can sort x objects in t seconds, as modeled by the function below:
    5·1 answer
  • What is working with others to find a mutually agreeable outcome?
    8·2 answers
  • the following names are considered valid names for variable except for a. ST_Name b. ST name c. STName​
    9·1 answer
  • __init__(self, features, phones): create/initialize instance variables for features and the list of phones (optional) in the pla
    7·1 answer
  • Why is it important for organizations to make strong commitment to Cloud at scale?
    14·1 answer
  • 5.9.5 Fibonacci <br><br> Y’all I’m struggling here do any of you have the code?
    12·1 answer
  • Advantages of email over traditional mail​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!