Answer:
The program to this question as follows:
Program:
price=float(input('Enter total price: ')) #define variable price and take user-input
print('Enter value of weight separately into pounds and onces: ') #print message
pounds=int(input('Input pounds value: ')) # defining variable pounds and take user-input
ounces=int(input('Input ounces value: ')) # defining variable ounces and take user-input
total_ounces=pounds*16+ounces # defining variable total_ounces and calculate variable
total=price/total_ounces # defining variable total and calculate price/ounces
print('price/ounces is: ',total) #print value
Output:
Enter total price: 25.50
Enter value of weight separately into pounds and onces:
Input pounds value: 1
Input ounces value: 9
price/ounces is: 1.02
Step-by-step explanation:
In the above python program code, a variable "price" is defined, that is takes price value from user, to take this value the "input and float" is used, in which the "float" convert value into decimal and input function is used for user- input.
- In the next line, the print function is declared, which is used for print message and variable values, in this function, we print a message that takes two values separately. Then two-variable "pounds and ounces" are defined that take integer value separately.
- In the last step, the total_ounces variable is defined, which calculates total ounces and the total variable will use to calculate the price per ounces. The print function is used to print this variable value.