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, 22.06.2019 10:30
You have a large, late-model pick-up truck with a rear seat. the pick-up truck weighs 6,500 pounds. the florida seat belt law
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 22.06.2019 20:40
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
question
Computers and Technology, 23.06.2019 04:00
In a word processing program, such as microsoft word, which feature to you choose the desired picture enhancement?
Answers: 2
You know the right answer?
Text Questions Please complete the following questions. It is important that you use complete sente...
Questions
question
Computers and Technology, 24.07.2019 10:20
question
Mathematics, 24.07.2019 10:20
Questions on the website: 13722360