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
konstantin123 [22]
3 years ago
8

Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc

es coupled together. You can assume the lengths of two sequences are the same. Try using a list comprehension.
Computers and Technology
1 answer:
In-s [12.5K]3 years ago
7 0

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

You might be interested in
Which statement about creating folders is TRUE?
slavikrds [6]
A creating one with help you share files with instructor
3 0
3 years ago
Read 2 more answers
What is the use of word art?
Westkost [7]

Answer:

Word art is used to modifying the shape of the text and the text features in micro-soft word such as colors, style and effects. In word art you can also used to create different styling and text features within your microsoft application and documents. It is also useful in flourishes your text.

5 0
3 years ago
Write a program that continually prompts the user for an integer input until input is entered that is less than 0. Each input th
professor190 [17]

Answer:

Following are the program in the C++ Programming Language:

#include <iostream>//header file

using namespace std;//namespane

//set main method

int main() {  

int a[100]; //set integer type array variable

int value, i = 0; //set integer variables

cout<<"Enter less than 0 to exit:"<<endl; //message for exit

cout<<"Enter the integer numbers:"<<endl; //message to enter numbers

do{ //set do while

cin>>value; //get input from the user

a[i++] = value; //append elements in array

}while(value>=0);

i--;  

cout<<"\nArray are:"<<endl;//message for array

for(int k = 0;k<i;k++){ //set for loop

cout<<a[k]<<" "; //print array

}

return 0;

}

<u>Output</u>:

Enter less than 0 to exit:

Enter the integer numbers:

1

2

3

4

5

-1

Array are:

1 2 3 4 5

Explanation:

Here, we set the integer data type main method "main()" and inside it:

  • we set integer type array variable with index value 100.
  • we set two integer type variable "value" and "i" initialize value 0.
  • we set the do-while loop in which we get the input from the user and and append in the array and pass condition if the value is greater then equal to 0.
  • Finally, set for loop and print the elements of an array.

 

7 0
3 years ago
Consider the following static method.
JulsSmile [24]
System of the state of national Es national
3 0
3 years ago
Among your selection in different online interfaces, which are your top three favorites?​
topjm [15]
What is this ? History or ?
6 0
3 years ago
Read 2 more answers
Other questions:
  • You can execute three main types of linux commands. what are they?
    8·1 answer
  • Diane wants to maintain a record of grades scored in the fifth, sixth, and seventh grades. She enters her grades and the total p
    13·1 answer
  • For a wire with a circular cross section and a diameter = 3.00mm calculate the following: (m means meter. mm means millimeter. c
    5·1 answer
  • Blank spaces or unseen control characters in a data file are referred to as
    5·2 answers
  • Assume that an array of integers named a that contains exactly five elements has been declared and initialized. Write a single s
    15·1 answer
  • What is the output of the following program?
    11·1 answer
  • How does an individual's access to a wide range of online services affects their ability to operate safely in the digital world.
    5·1 answer
  • Which cable standard is a standard for newer digital cable, satellite, and cable modem connections?
    11·1 answer
  • is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its r
    6·1 answer
  • Your program will be used by many departments at the university. Your comments will be important to their IT people. What would
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!