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 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Acloud service provider uses the internet to deliver a computing environment for developing, running, and managing software applications. which cloud service model does the provider offer? a. iaas b. caas c. maas d. paas e. saas
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
You know the right answer?
Text Questions Please complete the following questions. It is important that you use complete sente...
Questions
question
Mathematics, 04.03.2021 19:10
question
Health, 04.03.2021 19:10
question
Mathematics, 04.03.2021 19:10
question
Mathematics, 04.03.2021 19:10
Questions on the website: 13722360