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,...
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...
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...
A group of three-year-olds are presented with three photographs showing a dog, a cat, and a...
A group of three-year-olds are presented with three photographs showing a dog, a cat, and a horse as part of a cognitive test. Then they are given the words dog, cat and horse to match with the photographs. 17. Assuming that the children have not yet learned to associate the words with the images, what is the probability of obtaining a completely incorrect match? A. 0 b. 0.16 c. 0.33 d. 0.50 E. None of the above 18. Assuming that...
Assume you have a file called letters.txt containing all the lowercase letters of the alphabet in...
Assume you have a file called letters.txt containing all the lowercase letters of the alphabet in order one letter per line. What would be printed out by the following code? f = open("letters.txt") info = f.readline() print(len(info)) f.close() f = open("letters.txt") info = f.readline() info = f.readline() print(info[0]) f.close() f = open("letters.txt") info = f.readline() f.close() f = open("letters.txt") info = f.readline() print(info[0]) f.close()
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT