Question

Using Python Assigns the value of “dog” to the variable AnimalName. Assigns the value of “pigeon”...

Using Python

  1. Assigns the value of “dog” to the variable AnimalName.
  2. Assigns the value of “pigeon” to the variable AltAnimal.
  3. Includes an if-statement in which… (Hint: You should use both elif and else.)
    1. If the value of AnimalName is “cat”, prints “The animal is a cat.”
      1. 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”).
    2. If the value of AnimalName is the same as AltAnimal, prints “The animal is a [value of AltAnimal].”
    3. Or, if the AnimalName is “lemur”, prints “I am displeased with the value of AnimalName.”
    4. But otherwise prints “The animal is not a cat or [value of AltAnimal]. Apparently it is a [value of AnimalName].”
  4. Use placeholders to insert the variable values into your print statements.

Homework Answers

Answer #1

#Python code

AnimalName="dog"
AltAnimal="pigeon"
if AnimalName is "cat":       #check if value of AnimalName is cat
    print("The animal is a cat.")
elif AltAnimal is AnimalName:
    print("The animal is a %s."%(AltAnimal))
elif AnimalName is "lemur":
    print("I am displeased with the value of AnimalName.")
else:
    print("The animal is not a cat or %s. Apparently it is a %s."%(AltAnimal,AnimalName))

OUTPUT

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
Using Python Assigns the value “Phil” to the variable SomeName. Uses the len function and the...
Using Python Assigns the value “Phil” to the variable SomeName. Uses the len function and the SomeName variable to assign the number of letters in Phil’s name to the variable NameLength. Outputs the following using a print statement (the print statement should output the quotation marks and the values of the SomeName and NameLength variables where indicated by the [brackets]): “I very much enjoy infinite loops,” said [value of SomeName], whose name is [value of NameLength] letters long. Use placeholders...
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 =...
Draw a flowchart based on the Python code below: ch = -1 #Variable declared for taking...
Draw a flowchart based on the Python code below: ch = -1 #Variable declared for taking option entered by the user print("Enter 0 to 5 for following options: ") print("0-> Issue new ticket number.") print("1-> Assign first ticket in queue to counter 1.") print("2-> Assign first ticket in queue to counter 2.") print("3-> Assign first ticket in queue to counter 3.") print("4-> Assign first ticket in queue to counter 4.") print("5-> Quit Program.") tickets = [] #Declaring list to store...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance:...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance: ⦁   A base class called Pet ⦁   A mix-in class called Jumper ⦁   A Dog class and a Cat class that each inherit from Pet and jumper ⦁   Two classes that inherit from Dog: BigDog and SmallDog ⦁   One classes that inherit from Cat: HouseCat The general skeleton of the Pet, Dog, and BigDog classes will be given to you (see below, "Skeleton", but...
Please answer this using def (functions) in python 3 with a single print statement under #main....
Please answer this using def (functions) in python 3 with a single print statement under #main. Is this possible to do in one print as output? User specifies the number of books ordered, and if the order is online, or not. You can collect the second input by asking the user to enter 1 for online, and 0 for offline. You can assume that the user will enter 1 or 0 as directed. Unit price for a book is 15$....
In this assignment you will write a program that compares the relative strengths of two earthquakes,...
In this assignment you will write a program that compares the relative strengths of two earthquakes, given their magnitudes using the moment magnitude scale. Earthquakes The amount of energy released during an earthquake -- corresponding to the amount of shaking -- is measured using the "moment magnitude scale". We can compare the relative strength of two earthquakes given the magnitudes m1 and m2 using this formula: f=10^1.5(m1−m2) If m1>m2, the resulting value f tells us how many times stronger m1...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called keys with other objects called values. It is implemented as a Java class that uses arrays internally. 1. Theory. A map is a set of key-value pairs. Each key is said to be associated with its corresponding value, so there is at most one pair in the set with a given key. You can perform the following operations on maps. You can test if...
Facts from Client Interview Tumutch and Lotta Bolloni have been married for four years. They both...
Facts from Client Interview Tumutch and Lotta Bolloni have been married for four years. They both work very hard at their jobs – Lotta being an accountant and Tumutch working as a construction manager. They decide to splurge and look into booking an all-inclusive vacation to the enchanting Fantasy Island, in Fiji for February 2020. The Bollonis do some research into different travel packages and get quotes from various agencies. They narrow their choices down to three possibilities: Travelcations &...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
Team 5 answer the questions What are 4 key things you learned about the topic from...
Team 5 answer the questions What are 4 key things you learned about the topic from reading their paper? How does the topic relate to you and your current or past job? Critique the paper in terms of the organization and quality. Incentive Systems             In this paper, we will focus primarily on financial rewards that companies use to attract, retain and motivate the brightest and most talented candidates in the labor market. By providing a reward system that...