Skip to main content

19 | Why is this in loops?

What it is is:

gross_pay.py

# This program displays gross pay.
# Get the number of hours worked.
hours = int(input('Enter the hours worked this week: '))

# Get the hourly pay rate.
pay_rate = float(input('Enter the hourly pay rate: '))

# Calculate the gross pay.
gross_pay = hours * pay_rate

# Display the gross pay.
print(f'Gross pay: ${gross_pay:,.2f}')