Write a program that asks the user for the number of cats and the number of dogs registered in a course, storing the number of cats and dogs each in a variable. Print the percentage of cats in the course followed by a space and then print the percentage of dogs in the course.
Example: Suppose there are 8 cats and 12 dogs. There are 20 total animals in the class. The percentage of cats can be calculated as 100*(8 / 20) = 40.0. The percentage of dogs can be calculated as 100*(12 / 20) = 60.0.
I'm doing this on python.
Dear Student ,
As per requirement submitted above kindly find below solution.
Here new python program with name "catDogPercentage.py" is created which contains below code.
catDogPercentage.py :
#asking user for the number of cats registered
numberOfCats=int(input("Enter the number of cats registered :
"))
#asking user for the number of dogs registered
numberOfDogs=int(input("Enter the number of dogs registered :
"))
#calculate total animals
totalAnimals=numberOfCats+numberOfDogs
#calculate percentage of cats
print("{:0.1f}".format(100*(numberOfCats/totalAnimals)),"
","{:0.1f}".format(100*(numberOfDogs/totalAnimals)))
*********************************
Screen for indentation :

==================================
Output :Compile and run catDogPercentage.py to get the screen as shown below
Screen 1:catDogPercentage.py

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Write a program that asks the user for the number of cats and the number of...
Write a program that asks the user to input the number of males and females registered in a class (Max 30 members in the class). The program should display the percentage of males and females in the class. Python programming question
python program 6 Write an input validation loop that asks the user to enter a number in the range of 100 through 1000? 7 Write an input validation loop that asks the user to enter ‘Y’, ‘y’, ‘N’, or ‘n’? 8 How many times the following loop will repeat? cnt = 0 while cnt != 5: print(cnt) cnt = cnt + 2
Write a PYTHON program that asks the user for the name of the file. The program should write the contents of this input file to an output file. In the output file, each line should be preceded with a line number followed by a colon. The output file will have the same name as the input filename, preceded by “ln” (for linenumbers). Be sure to use Try/except to catch all exceptions. For example, when prompted, if the user specifies “sampleprogram.py”...
Python 3: Write a program in python that asks the user to enter a number that contains 4 digits, i.e. in the range [1000-9999]. Your program MUST take it as a number integer. Print each digit on a separate line.
USING PYTHON 1. Write a small program that asks for an integer number from the user and print all the prime numbers (2,3,5,7,etc) less than the input number. 2. How long it takes for your program to print the prime numbers less than 100. (Use magic functions)
Python Write a program which asks the user keep inputting values on a line followed by enter until they enter a blank line, at which point the program should print the number of lines entered (excluding the blank).
Write a Python program that asks the user to enter the number of calories and fat grams in a food item. The program should display the percentage of the calories that come from fat. One gram of fat has 9 calories, therefore: Calories from fat = fat grams * 9 The percentage of calories from fat can be calculated as follows: Calories from fat / total calories If the calories from fat are less than 30 percent of the total...
Write a small program that asks the user how many asterisks it should print out. The user responds with a number, then the program prints that number of asterisks. The number of asterisks to print should be stored in a variable. Finally the program asks the user if it should start over, and repeats as many times as the user wants. The prompt to run the program again should look like the one below, and should wait at the end...
Python Programming 4th Edition: Write a program that asks the user for the number of feet. The program converts those feet to inches by using the formula ’12 * feet’. Hint: Define main () program Get the number of feet from the user Define variables Call a function feet_to_inches(feet) The function receives the number of feet and returns the number of inches in that many feet. The output should look like as follows: Enter the number of feet: If the...
IN PYTHON Write a program that asks the user for the name of a file . The program should display the contents of any file with each line preceded with a line number followed by a colon. The line number should start at 1