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
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))
Write a program that asks the user to input the number of males and females registered...
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 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 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 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. 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...
1. Day of the Week Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside the range of 1 through 7. (On PYTHON IDLE...
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
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
Write a script that asks the user to input a number. If the value the user enters is a negative value, call the pre-defined function neg_value which consumes no arguments and returns no values. If the user enters a positive value, call the pre-defined function pos_value which consumes no arguments and returns no values. If the user enters a zero, display the message "Invalid Value". Doing this on Python. This is what I have: number = int(input("Enter a 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