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
Nuetrik [128]
4 years ago
8

g Write a Racket function (process lst1 lst2) that processes the corresponding elements of the two lists and returns a list. If

the corresponding elements are both numbers, include the sum of the two corresponding elements in the list that is returned.
Computers and Technology
1 answer:
blagie [28]4 years ago
8 0

Answer:

  1. def process(lst1, lst2):
  2.    newList = []
  3.    for i in range(0, len(lst1)):
  4.        sum = lst1[i] + lst2[i]
  5.        newList.append(sum)
  6.    return newList
  7. list1 = [1, 3, 5, 7, 9]
  8. list2 = [2, 4, 6, 8, 10]
  9. print(process(list1, list2))

Explanation:

Firstly, create a function process that takes two input lists (Line 1). In the function, create a new list (Line 2). Use a for loop to traverse through the elements of the two lists and total up the corresponding elements and add the sum to the new list (Line 3 - 5). At last, return the new list (Line 6).

In the main program, create two sample list and use them as arguments to test the function process (Line 8 - 9). We shall get the output  [3, 7, 11, 15, 19].

You might be interested in
Which of the following networks had these two goals: a) allowing scientists to work together on scientific projects; and, b) fun
mrs_skeptik [129]

Answer:

ARPANET

Explanation:

It was the ARPANET sponsored by the US Department of Defense to enable scientists collaborate on research.

5 0
3 years ago
Read 2 more answers
Which of the following were input devices for early portable computers?
nordsb [41]

Answer:

Notebooks

Explanation:

The answer is Notebooks

5 0
3 years ago
Which is a good plan for backing up data?
Ymorist [56]
A, use external storage media such as CDs.
4 0
4 years ago
A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that
prisoha [69]

In Python, assume that a file containing a series of integers is named numbers.txt and exist on the computer's disk. Write a program that reads the entire numbers store in the file and calculates their total.

Here is what I have written but it does not run:  

def. main():

   out file=open('numbers.txt','r')

   temp=outfile.readline()

   total=0

   while temp!='':

       t=int(temp)

       total=total+i

       temp=outfile.readline()

       outfile.close()

       print('Total sum is:',total)

main()

Text file is a file named numbers.txt with the numbers 1-50 in it

Learn more:

  • The sum of three consecutive integers is 186. what are the integers

        brainly.com/question/1768254

Keywords: python, integers, computer, numbers, program

6 0
3 years ago
Read 2 more answers
Describe the Pointer with example?​
kodGreya [7K]

Answer:

A pointer is a variable that stores the address of another variable. Unlike other variables that hold values of a certain type, pointer holds the address of a variable. For example, an integer variable holds (or you can say stores) an integer value, however an integer pointer holds the address of a integer variable.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that defines a type for a structure that stores information on a student in ENG EK 125. Declare two variables to
    8·1 answer
  • "The OSI model has seven layers and the DoD has four. At which layer does SMTP works in both models"?
    15·1 answer
  • When a process becomes digital, it often becomes cheaper and the workflow becomes simpler. True False
    5·2 answers
  • Technician A says that wheel speed sensors are a highly probable cause of illuminated EBC warning lamps. Technician B says that
    10·1 answer
  • Write a C++ program that asks the user to enter his age. The program then should display the age in months:
    11·1 answer
  • The gradual wearing away or breaking down of rocks by abrasion is a type of __________________ weathering.
    8·1 answer
  • Who is the father of computer?<br>1.Charles Babbage 2.James Waat​
    15·2 answers
  • You develop an app, and you don’t want anyone to resell it or modify it. This is an example of: A
    5·1 answer
  • One benefit proprietary licensed software is that it
    9·1 answer
  • Within a master slide template, you can create a custom slide layout. Place the steps to complete this task in the correct order
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!