subject

Text Questions Please complete the following questions. It is important that you use complete sentences and present the questions and answers when you submit your work.

Submit the work as a file attachment. This means you will complete all work in a word processing document (e. g. Microsoft Word) and attach the file using the Submit Text Questions activity in your Course Map.

You’ve learned about lists and defining your own functions. Now, you will put those skills together by writing a program that will print out all of the even items in a list.

Step 1: Practice
But before we do that, let’s visualize a bit of code to be sure you understand how it works. We are going to run the code in a visualizer. A visualizer shows you not just the output of the code but also what is happening step by step.

Go to this website: http://pythontutor. com/visualize. html#mode=edit

Then, type in this code:

my_list = [1, 2, 3, 4, 5]
for x in range(len(my_list)):
print(my_list[x])
Now, click on the Visualize Execution button. You will see a screen that has your code on the left and a blank area on the right.

Next, press the Forward > button. On the right, you will see a visual representation of the fact that the code has created a list; you will also see the items in the list as well as their index numbers.

Press the Forward > button until you have finished the program. Did you notice how the red and green arrows showed you which lines of the program had just executed and which ones were about to execute during each step of the way through the program?

Now, let’s review the program itself. The first line of this code creates a list called my_list . Then, the second line is the command to iterate over the list using a variable that we call x . We did this iteration by making the range equal to the length of the list. For each iteration, it printed the item from the list that had the same index as the iterating variable. Now, you should be comfortable with iterating over a list and accessing each item in the list as you iterate over the list by using the incrementing variable as the index number.

Step 2: Program
Now, we’re ready to program! Leave the visualizer and go back to https://repl. it/ to write your program.

Here is the pseudocode for your program:

Define a function called “even_checker” that will do the following things:

Iterate over a list.
Check to see whether the values in the list are even.
Print the even values.
Create a list with ten numbers in it. (Some of your numbers should be odd, and some should be even.)

Call the function on your list.

When you have tested your program, take a screenshot of it and its output to turn in. If your program does not work properly, also include a paragraph explaining what you did to troubleshoot it.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 11:00
How should you specify box sizes on a web page if you want the boxes to vary according to the font size of the text they contain? a. in pixels b. in inches c. as percentages d. in em units
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a.edit the sizes and other characteristics of photos that have been inserted. b.take a screenshot of an image and copy it to the clipboard for pasting. c.search for drawings or other images from a library of prepared pictures. d.make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
You know the right answer?
Text Questions Please complete the following questions. It is important that you use complete sente...
Questions
Questions on the website: 13722360