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
Please choose the correct answer please tell fast​
pav-90 [236]

Answer:

the answer might be 2......

7 0
3 years ago
Jack is writing a paragraph for a school assignment. He proofreads his paper and notices that he used the word, "then" many time
Lynna [10]

He should use a Thesaurus.

5 0
3 years ago
Read 2 more answers
a FOR loop that will draw 3 circles with a radius of 20 exactly 50 points apart in a vertical line. the first points should be (
svlad2 [7]

Answer:

hfdhcb

Explanation:

lhvsxdlwsd

3 0
2 years ago
What type of font color should Kim select if she chooses a dark-colored design theme for her presentation?
enot [183]

white or light colors

5 0
2 years ago
Read 2 more answers
What is thesql command to list the total sales by customer , month , and product, with subtotals by customer and by month and a
alexira [117]

Answer:

The answer is below

Explanation:

The the sql command to list the total sales by customer , month , and product, with subtotals by customer and by month and a grand total for all product sales is:

SELECT S.CUS_CODE, T.TM_MONTH, S.P_CODE,

SUM(S.SALE_UNITS*S.SALE_PRICE) AS "TOTSALES"

FROM DWDAYSALESFACT AS S INNER JOIN DWTIME AS T ON S.TM_ID =

T.TM_ID

GROUP BY S.CUS_CODE,T.TM_MONTH,S.P_CODE WITH ROLLUP;

4 0
2 years ago
Other questions:
  • A .jpg file is an example of which of the following file types
    15·2 answers
  • Define a romanNumberToInt function that converts a RomanNumber value, which is a list of Roman digits, into an integer. Hints: -
    7·1 answer
  • Clive wants to write a query that will display the names of the students who scored less than 10 in their final exams. Which num
    8·2 answers
  • Patricia is leading an online group of students from many
    8·2 answers
  • Communication is the transmission of messages to large audiences.
    14·1 answer
  • Explain one way in which programmers may get hired.
    9·1 answer
  • Write the definition of a function that takes as input three numbers. The function returns true if the floor of the product of t
    11·1 answer
  • Select the correct answer.
    7·2 answers
  • Write pseudocode for the question below:
    15·1 answer
  • How does beamforming improve network service?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!