Question: When I run my print function in python, it said there is a problem: format(employ_ID, ',.2f'), sep='' ) ValueError: Unknown format code 'f' for object
When I run my print function in python, it said there is a problem: format(employ_ID, ',.2f'), sep='' ) ValueError: Unknown format code 'f' for object of type 'str'.
Under is how I wrote my format program, where I did run? Please tell me. the 'employ_ID' is the variable I created. I have to sue the format function in this programming.
print('ID Number: ', format(employ_ID, ',.2f'), sep='' ) print('Pay Rate: ', format(regular_payrate, ',.2f'), sep='') print('Regular Hours: ', format(regular_hours, ', .2f'), sep='') print('Overtime Hours: ', format(overtime_hours, ',.2f'), sep='') print('Total Hours: ', format(hours, ',.2f'), sep='') print('Regular Pay: ', format(regular_payrate, ',.2f'), sep='') print('Overtime Pay: ', format(overtime_pay, ',.2f'), sep='') print('Gross Pay: ', format(gross_pay,',.2f'), sep='') print('Deductions: ', format(deduction,',.2f'), sep='') print('Net Pay: ', format(net_pay, ',.2f'), sep='')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
