Question

Write a program that asks the user to input the number of males and females registered...

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1
males = int(input("Enter number of males in class: "))
females = int(input("Enter number of females in class: "))

print("Percentage of males in class is", (males * 100) / (males + females))
print("Percentage of females in class is", (females * 100) / (males + females))
Add a comment
Know the answer?
Add Answer to:
Write a program that asks the user to input the number of males and females registered...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a program that asks that asks the user for the number of males and females...

    Create a program that asks that asks the user for the number of males and females in a class. The program should display a percentage of males and females. For example, there are 5 males, and 15 females. That makes 20 people total. To find the percentage of males you can divide 5 by 20, which makes 0.25, or 25% HINT: USE A VARIABLE for every group of people that you will use in your calculation. Submit your .java source...

  • Write a program that asks the user to enter a string and then asks the user...

    Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming

  • Write a program that asks the user for the number of cats and the number of...

    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...

  • Write a Python program that asks the user to enter the number of calories and fat...

    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...

  • Python Programming 4th Edition: Write a program that asks the user for the number of feet....

    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...

  • python program 6 Write an input validation loop that asks the user to enter a number...

    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 programme in a Jupyter notebook which asks the user to input the number...

    Write a python programme in a Jupyter notebook which asks the user to input the number of radioactive nuclei in a sample, the number at a later time, and the elapsed time. The programme should calculate and display the decay constant and the half-life. The decay is described by the equations: ? = ? ?−?? ?0 ?1/2 = ln (2)/? PLEASE INCLUDE COMMENTS ON CODE. THANKS

  • Write a program that asks the user to enter a number ofseconds.• There are...

    Starting Out with C++ (9th Edition)  Chapter 4, Problem 7PCWrite a program that asks the user to enter a number of seconds.• There are 86400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds.• There are 3600 seconds in an hour. If the number of seconds entered by the user is less than 86400, but is greater...

  • MIPS programming question Problem 1: Write a program that asks the user to input a string...

    MIPS programming question Problem 1: Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the...

  • Write a program in python that asks the user to input a sentence. The program will...

    Write a program in python that asks the user to input a sentence. The program will ask the user what two letters are to be counted. You must use a “for” loop to go through the sentence & count how many times the chosen letter appears in the sentence. You are not allowed to use python built-in function "count()" or you'll get a Zero! Output will show the sentence, the letter, and the number of times the letter appears in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT