Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program which asks the user to enter the number of ducks, dogs, cats and flamingoes. Assuming ducks and flamingoes have 2 legs

image text in transcribed 

Write a program which asks the user to enter the number of ducks, dogs, cats and flamingoes. Assuming ducks and flamingoes have 2 legs and no tails while dogs and cats have 4 legs and a tail, determine the total number of legs and tails as shown below. Your output must match the sample run exactly. Sample runs: Enter the number of ducks: 3 Enter the number of dogs: 4 Enter the number of cats: 5 Enter the number of flamingoes: 2 You have a total of 46 legs and 9 tails Enter the number of ducks: 0 Enter the number of dogs: 0 Enter the number of cats: 0 Enter the number of flamingoes: 1 You have a total of 2 legs and O tails

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Python Get input from the user numducks intinputEnter the number of ducks numdogs intinputEn... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions

Question

What is the role of cognition and thought in learning?

Answered: 1 week ago