Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, ghazanfarwaheed7967
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
image
Computers and Technology, 22.06.2019 15:00, yeet74
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, evanwall91
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, larry5007
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
Do you know the correct answer?
Text Questions Please complete the following questions. It is important that you use complete sente...

Questions in other subjects:

Konu
English, 13.02.2021 03:10