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
Marrrta [24]
3 years ago
9

How to create a function, called separate_int_and_str, which takes in a list and separates out the integer values and strings in

to their own lists in python?
Computers and Technology
1 answer:
gregori [183]3 years ago
4 0

Answer:

program :

def separate_int_and_str(list_1):# function to seprate the list.

   str_list=[] #list to hold the

   int_list=[]#list which holds the integer value.

   for x in list_1: #for loop to extract the list.

       if(type(x)==str): #if condition to check the type of the element.

           str_list.append(x)#create a list for the string value.

       elif(type(x)==int): #check condition for th einteger value.

           int_list.append(x)#create a list for the integer value.

Explanation:

  • The above-defined function is written in the python language, which used the code to separate the list for integer and the string value.
  • There are two lists define in the function which holds the integer and the string value separately.
  • There is a 'for' loop which scans the element of the list and checks the list by the help of type function which tells the class of the element.
  • Then if the type function states that the element is from the strong class, it will assign the element on the string list otherwise it assigns the element in the integer list.
You might be interested in
How to implement switch statement in Python?
Jet001 [13]

Answer:

Switch-case statements are a powerful tool for control in programming. In this article, Sreeram Sceenivasan goes over you can use a switch-case statement in Python.

Explanation:

Python doesn’t need a switch statement. You can do exactly the same thing with if/elif/else statements.

5 0
3 years ago
Read 2 more answers
For each of the descriptions below, perform the following tasks:
zlopas [31]

Answer:

Explanation:

The underlined traits in the ER chart speak to essential key since they remarkably recognize the quality  

(a)

(I) The level of the given relationship is 2 i.e it is a parallel connection among Book and Publisher. It is a one to numerous relationship from distributer to book in light of the fact that a distributer can distribute any number of books however a book will have only one publisher,so the cardinality will be 1 to 1..* (one to many)

(b)

(i) The degree of the given relationship is 2 i.e it is a binary relationship between Author and Book. It is a many to many relationship from Book to Author a book can be written by one or more authors and an author can write more than one book, so the cardinality will be 1..* to 1..* (many to many)

(c)

(i) As mentioned in part (b), the degree of given relation is 2 and cardinality is many to many (1..* to 1..*)

(d)

(i) The degree of the given relationship is 1 i.e unary relationship. It is a many to many relationship because one book can belong to any sets and a set can have any number of books, so cardinality is 1..* to 1..* (many to many)

Note: attached below is the image of various options to confirm the explanation (answer).

cheers i hope this helped !!!

4 0
4 years ago
Clicking a _____ takes you to a webpage that no longer exists or has been moved.
Ne4ueva [31]

Answer: Clicking a __<u>dead link</u>___ takes you to a webpage that no longer exists or has been moved.

5 0
4 years ago
Read 2 more answers
The rectangle shape in flowchart is used for
kvasek [131]
<h2>Start</h2>

The rectangle shape in flowchart is used to capture process steps like basic tasks or actions in your process.

4 0
2 years ago
Which of the following devices is used to connect multiple devices to a network and sends all traffic to all connected devices?
Stels [109]

Answer: HUB

Explanation:

A Hub is a network device, that acts only in layer 1 (Physical layer) forwarding all traffic that reaches to the input port, to all output ports at once, without processing the received data in any way that could modify them.

It behaves like it were a multiport repeater (which has only one output port).

5 0
3 years ago
Other questions:
  • Imagine you are spending the weekend with your family in a location with ZERO technology- no phones, TV, computers, video, radio
    10·1 answer
  • The general manager for a retail clothing outlet was recently cited as saying, IT is the cornerstone of our company. All of our
    9·1 answer
  • Jim works the parts counter for a busy car dealership. When answering the phone, Jim often has trouble answering the customer's
    6·1 answer
  • Write a fragment of code that reads in integers from standard input, until end-of-file and sends their (floating point) average
    14·1 answer
  • The LPN/LVN cares for an older client admitted to the hospital for treatment of a fractured femur. The LPN/LVN notes the client
    10·2 answers
  • Which setting is used to determine the order of printing pages?
    15·1 answer
  • Each contestant auditioned her singing voice for the pageant. Participle: Word it Modifies:​
    14·1 answer
  • Complete the following statements by choosing the correct answer from the drop-down menus.
    6·1 answer
  • Choose the statement that is true please help me fast like right now
    12·1 answer
  • An IP address specifically belongs to:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!