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
A junior network administrator tells you that he can ping a DNS server successfully using its IP address, but he has not tested
Darya [45]

Answer:

nslookup is the correct answer to the following question.

Explanation:

The following answer is correct because It is the tool or the utility of the command line by which an administrator to query a DNS(Domain Name System) for finding the domain name or the Internet Protocol address or many other records.

<u>Steps to use nslookup:</u>

  • Firstly, you have to press the window key + R to open run.
  • Then, you have to type cmd in it and press enter.
  • Then, cmd will appear after that, you have to type the command 'nslookup' and then press enter.
  • Then, it shows the default server name and ip address after that, you have to type an ip address of DNS server.
  • Then, you have to type 'set' then type q=M X and then press enter
  • Then, you have to type the name of your domain then, press enter key.

7 0
3 years ago
In C Coding, print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unkn
shutvik [7]

The code below uses if-else structure to print the output depending on the value of the userItem.

If the specified condition in the if structure is true, the block in the structure gets executed.

Comments are used to explain the each line of the code.

//main.c

#include <stdio.h>

int main()

{  

   //defining the enum and userItem

   enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};

   enum GroceryItem userItem;

   //initializing the userItem

   userItem = GR_APPLES;

   

   //checking the userItem

   //If it is GR_APPLES or GR_BANANAS, print "Fruit"

   //If it is GR_JUICE or GR_WATER, print "Drink"

   //Otherwise, print "Unknown"

   if(userItem == GR_APPLES || userItem == GR_BANANAS){

       printf("%s\n", "Fruit");

   }

   else if(userItem == GR_JUICE || userItem == GR_WATER){

       printf("%s\n", "Drink");

   }

   else{

       printf("%s\n", "Unknown");

   }

   

   return 0;

}

You can see a similar question at:

brainly.com/question/17592042

6 0
3 years ago
Why should the government create money it doesn’t have?
murzikaleks [220]

Answer:

to increase economy of the country

Explanation:

if the government does so the people will be able to access the money this increasing government revenue. This increasing the economy

8 0
3 years ago
Read 2 more answers
A database program helps to ____________. A. Organize, send, and retrieve e-mails quickly b. Deliver elegant presentations to a
jarptica [38.1K]

Answer: D

Explanation: D. A database is software which is designed to store massive amounts of data and organize them in such a way that information can easily be worked on (added, deleted, moved, etc...).

7 0
3 years ago
Write a recursive function sumAll that accepts an integer argument and returns the sum of all the integers from 1 up to the numb
slavikrds [6]

Answer:

int sumAll(int n)//function definition.

{

   if(n==1)//if condition.

   return 1;

   else//else condition.

   {

       return n+sumAll(n-1);//return the value and call the function in recursive manner.

   }

}

Explanation:

  • The above-defined function is a recursive type function that is written in the c language, which holds the if and else condition.
  • When the user passes the largest value from 1, then the else condition will be executed which adds the largest value and pass the value after the decrement of the value as an argument.
  • When the value will become 1, then the function if-block will be executed which returns the value and ends the calling function recursively.
8 0
3 years ago
Other questions:
  • What are the changes in ios 14.2? What are the benefits of the ios developer program? What is next for Apple? Base your answers
    14·1 answer
  • 1) which colour filter is used to pumps up black and white effects?
    13·1 answer
  • Text that does not fit in a cell
    7·1 answer
  • C programmig : Output all combinations of character variables a, b, and c, using this ordering:abc acb bac bca cab cbaSo if a =
    12·2 answers
  • Which of the following are examples of typical problems an ISS professional would encounter? Check all
    5·2 answers
  • When you are pasting an item, what choice will the Paste Options button offer you?
    9·1 answer
  • Write a computer program that determines how many grades are between 0 and 19.
    8·1 answer
  • Explain the applications software that you use everyday
    5·1 answer
  • How many characters should a strong password have? four six eight ten
    10·2 answers
  • Write a function that receives a StaticArray and returns an integer that describes whether the array is sorted. The method must
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!