India Languages, asked by sreedimpul2404, 11 months ago

Write a program to prompt the user for hours and rate per hour and rate per hour using input

Answers

Answered by codiepienagoya
0

Following are code for input value in python:

Output-1:

Enter hour value: 12

Enter rate per hour: 300

Hours:  12

Rate:  300.0

Total Income $: 3600.0

Output-2:

Enter hour value: 6

Enter rate per hour: 300

Hours value:  6

Rate value:  300.0

Explanation:

Program-1:

hour=int(input("Enter hour value: "))#defining hour variable for user input

rate_per_hour=float(input("Enter rate per hour: "))#defining rate_per_hour for user input

Income= hour*rate_per_hour#defining Income variable for calclate value

print("Hours: ",hour)#print hour value

print("Rate: ", rate_per_hour) #print rate_per_hour value

print("Total Income $:", Income)#print calclating Income value

Program-2:

hour=int(input("Enter hour value: "))#defining hour variable for user input

rate_per_hour=float(input("Enter rate per hour: "))#defining rate_per_hour for user input

print("Hours value: ",hour)#print hour value

print("Rate value: ", rate_per_hour) #print rate_per_hour value

program description:

  • In the above program, both programs have defined two input variable that is "hour and rate_per_hour", both use input method and use a different type of input values like integer and float.
  • In program 1, an income variable is declared, that multiply the above input values and uses the print method for print the input and calculated value.
  • In program 2, it uses the print method for print input values.

Note:

In the given question it only asks for program-2, but we define its further calculation. I hope you like it.

Learn more:

  • Input method: https://brainly.in/question/9034835
Similar questions