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]
3 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]3 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
What type of waves in the electromagnetic spectrum has the Search for Extraterrestrial Intelligence (SETI) mostly analyzed in th
charle [14.2K]
I would say A because the SETI Institute said, "Philip Morrison and Guiseppe Cocconi analyzed how two civilizations separated by many light years of space might use electromagnetic radiation to communicate.

Electromagnetic radiation is the general term for the more familiar light and radio waves."

So there you go!

3 0
3 years ago
Coupon collector is a classic statistic problem with many practical applications. The problem is to pick objects from a set of o
ahrayia [7]

Answer:

Here is the JAVA program:

public class Main {  //class name

public static void main(String[] args) {   //start of main method

//sets all boolean type variables spades, hearts diamonds and clubs to false initially

   boolean spades = false;  

   boolean hearts = false;

   boolean diamonds = false;

   boolean clubs = false;  

   String[] deck = new String[4];  //to store card sequence

   int index = 0;  //to store index position

   int NoOfPicks = 0;  //to store number of picks (picks count)

   while (!spades || !hearts || !diamonds || !clubs) {   //loop starts

       String card = printCard(getRandomCard());  //calls printCard method by passing getRandomCard method as argument to it to get the card

       NoOfPicks++;   //adds 1 to pick count

       if (card.contains("Spades") && !spades) {  //if that random card is a card of Spades and spades is not false

           deck[index++] = card;  //add that card to the index position of deck

           spades = true;  //sets spades to true

       } else if (card.contains("Hearts") && !hearts) {  //if that random card is a card of Hearts and hearts is not false

           deck[index++] = card;  

           hearts = true;   //sets hearts to true

       } else if (card.contains("Diamond") && !diamonds) {  //if that random card is a card of Diamond and diamonds is not false

           deck[index++] = card;

           diamonds = true;  //sets diamonds to true

       } else if (card.contains("Clubs") && !clubs) {  if that random card is a card of Clubs and clubs is not false

           deck[index++] = card;

           clubs = true;         }     }   //sets clubs to true

   for (int i = 0; i < deck.length; i++) {  //iterates through the deck i.e. card sequence array

       System.out.println(deck[i]);     }  //prints the card number in deck

   System.out.println("Number of picks: " + NoOfPicks);  }   //prints number of picks

public static int getRandomCard() {  //gets random card

   return (int) (Math.random() * 52); }   //generates random numbers of 52 range

public static String printCard(int cardNo) {   //displays rank number and suit

   String[] suits = { "Spades", "Hearts", "Diamonds", "Clubs", };  //array of suits

   String[] rankCards = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10",

           "Jack", "Queen", "King" };   //array of rank

  int suitNo = cardNo / 13;  //divides card number by 13 and stores to suitNo

 int rankNo = cardNo % 13;   //takes modulo of card number and 13 and store it to rankNo

   return rankCards[rankNo] + " of " + suits[suitNo];  }}  //returns rankCard at rankNo index and suits at suitNo index

Explanation:

The program is explained in the comments attached with each line of code. The screenshot of the program along with its output is attached.

8 0
3 years ago
After correctly configuring a new wireless enabled thermostat to control the temperature of the company's meeting room, Joe, a n
ZanzabumX [31]

Answer:

The WPA2 shared key is incorrect is the correct answer.

Explanation:

The WPA2 shared key is incorrect because when the technician installs a new wireless thermostat for the purpose to control the temperature of the meeting room. Then, admin determines that the thermostat is not connecting to the control system through the internet and the admin authenticate that its parameter of receiving thermostat is associated with the AP. So, that's why the following option is correct.

8 0
3 years ago
High quality pages in a task should all get the same Needs Met rating. For example, a high quality page for a common interpretat
marysya [2.9K]

Answer:

False

Explanation:

High quality page for a common interpretation always have different Needs Met rating than the high quality page for a minor interpretation of the query.

Although, both of this pages are of high quality we must differentiate the common from a minor interpretation of a query.

Needs Met should always know to place the high quality pages in a resolution hierarchy.

7 0
3 years ago
What happens when you print a document with red, green, and blue underline?
Olegator [25]
They will not show up on pages

8 0
2 years ago
Read 2 more answers
Other questions:
  • Steve wants to become a successful graphic design entrepreneur. Which entrepreneurial approach will help him succeed? A. working
    14·1 answer
  • Any program that allows the user to select an item from a menu should ________ the user's selection.
    7·1 answer
  • When is the bond between the actin and myosin head is broken? when an ATP molecule binds to the myosin head when an ATP molecule
    6·1 answer
  • which of these describe raw data?check all of the boxes that apply A) what a person buys B) where a person lives C) data that ha
    9·1 answer
  • What are the features of Cobol language that make it suitable for programming business applications.
    6·1 answer
  • (5 points) Create a user-defined data structure (i.e., struct) called Point that represents a two-dimensional Cartesian coordina
    5·1 answer
  • If a fire should break out in your building, which of the following actions is NOT recommended?
    10·2 answers
  • If Anyone can help me out that'll be great
    11·1 answer
  • A trackerball is a pointing device
    9·1 answer
  • Why isn't image display working on wacom tablet.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!