Question

animals = ['cat','dog','fish'] print [animals] print (animals[0]): for animal in animals: print(animal) for id,animal in enumerate(animals):...

animals = ['cat','dog','fish'] print [animals] print (animals[0]): for animal in animals: print(animal) for id,animal in enumerate(animals): print(id) print(animal) animals.append('rabbit') print (animals) #print (animals.upper()) for animal in animals: print(animal.upper()) print ("You have " + str(len(animals))+" animals in your list.") What will print in the line #print(animals.upper())in code block A?

Homework Answers

Answer #1
animals = ['cat','dog','fish']
print (animals)
print (animals[0])
for animal in animals:
    print(animal)
for id,animal in enumerate(animals):
    print(id)
    print(animal)
animals.append('rabbit')
print (animals)
#print (animals.upper)
for animal in animals:
    print(animal.upper())
print ("You have " + str(len(animals))+" animals in your list.")

Code print in the line #print(animals.upper())in code block A is

CAT
DOG
FISH
RABBIT

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
animals = ['cat','dog','fish'] print [animals] print (animals[0]): for animal in animals:                 print(animal) for id,animal in enumerate(animals):...
animals = ['cat','dog','fish'] print [animals] print (animals[0]): for animal in animals:                 print(animal) for id,animal in enumerate(animals):                 print(id)                 print(animal) animals.append('rabbit') print (animals) #print (animals.upper) for animal in animals:                 print(animal.upper()) print ("You have " + str(len(animals))+" animals in your list.") After the code executes, what is the index value for the last item in the list?
• Use this array: string[] pets = {"dog", "cat", "parakeet", "guinea pig", "dire rabbit", "hamster", "ferret",...
• Use this array: string[] pets = {"dog", "cat", "parakeet", "guinea pig", "dire rabbit", "hamster", "ferret", "velociraptor"}; • Using a for loop go through the array o Change the value of each element by adding an s to the end o Print out the index and the animal at that index  e.g. when counter = 2 I should see  pet at index 2 is parakeets • Using the foreach loop, print out the items of the array •...
Using Python Assigns the value of “dog” to the variable AnimalName. Assigns the value of “pigeon”...
Using Python Assigns the value of “dog” to the variable AnimalName. Assigns the value of “pigeon” to the variable AltAnimal. Includes an if-statement in which… (Hint: You should use both elif and else.) If the value of AnimalName is “cat”, prints “The animal is a cat.” Includes a comment on the same line as this if-statement that explains what the if-statement is looking for (i.e., what would have to be true for the statement to return “true”). If the value...
The county animal shelter has hired you to design a database to track the animals at...
The county animal shelter has hired you to design a database to track the animals at the shelter along with the people who adopt them. You have worked with the staff at the shelter, analyzed how they perform the work now, performed user requirements gathering and you have to create an ERD. Below you will find the description of the entities and attributes defined during this process. Animal: animal_id, species, breed, age, gender, size, spay/neuter, intake_date, location, cost Adopter: name,...
The county animal shelter has hired you to design a database to track the animals at...
The county animal shelter has hired you to design a database to track the animals at the shelter along with the people who adopt them. You have worked with the staff at the shelter, analyzed how they perform the work now, performed user requirements gathering and you have created a DFD. Below you will find the description of the entities and attributes defined during this process. Animal: animal_id, species, breed, age, gender, size, spay/neuter, intake_date, location, cost Adopter: name, phone,...
a. Design a FSA that will recognize sentences such as “The dog that chased the cat...
a. Design a FSA that will recognize sentences such as “The dog that chased the cat that ate the mouse lived in the house that Jack built.” Namely, the sentences should look like “The ANIMAL1 that VERBED1 the ANIMAL2 that VERBED2 the ANIMAL3 … VERBED3 in the house that Jack built.”, where ANIMALn is an animal and VERBEDn is a past-tense verb, and where the maximum n can be arbitrarily large. Assume that words are fed to the FSA one...
Which is the better pet a cat or dog ?Well which is the better fruit ,...
Which is the better pet a cat or dog ?Well which is the better fruit , an apple or an orange? Down through the years , those Hary little entities have been part of my life . I have pre-dominantly fond thoughts every one of them , except possibly smoky, who used to get lost and had to be bailed out of the pound all the time . You can't lump your pets together by their species any more than...
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4...
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4 enter directory inlab4 create a new file named by reverse.c with the following contents and then close the file: /*reverse.c */ #include <stdio.h> reverse(char *before, char *after); main() { char str[100]; /*Buffer to hold reversed string */ reverse("cat", str); /*Reverse the string "cat" */ printf("reverse(\"cat\")=%s\n", str); /*Display result */ reverse("noon", str); /*Reverse the string "noon" */ printf("reverse(\"noon\")=%s\n", str); /*Display result */ } reverse(char *before,...
convert this code to accept int value instead of float values using python. Make sure to...
convert this code to accept int value instead of float values using python. Make sure to follow the same code. do not change the steps and make sure to point to what code you replaced. make sure to have 2 files Method:----------------------- #define a python user difined method def get_float_val (prompt): is_num = False str_val = input (prompt) #prming read for our while #while is_num == False: (ignore this but it works) old school while not is_num: try: value =...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two different classes in the program being made as objects in the main (Bunny class and Dog Class). ask the user "what kind of animal would you like to sort?" user chooses the type of animal (bunny or dog), then you ask the user how big would you like the array of animals to be (maximum array size = 20)? and then you ask what...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT