Question
I wrote python, and the professor common like: Use of magic number is not accepted either use named constant or explain them by comments. 1.5,
I wrote python, and the professor common like:
Use of magic number is not accepted either use named constant or explain them by comments.
1.5, 25, .105 are all magic numbers.
Use proper minimum field width in format function and special character as \t. Its in chapter 2.
The program output should be formatted in column style as shown below:
ID Number: 123
Pay Rate: 9.50
Regular Hours: 40
Overtime Hours: 10
Total Hours: 50
Regular Pay: 380.00
Overtime Pay: 142.50
Gross Pay: 522.50
Deductions: 25.0
Net Pay: 497.50
Shouldn't be the way your output is showing. All the values are at different positions.
and my syntax is written like: print('ID Number: ',employ_ID) print('Pay Rate: ', format(regular_payrate, ',.2f'), sep='') print('Regular Hours: ',regular_hours) print('Overtime Hours: ',overtime_hours) 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='')
My output is:
Enter an employee ID:1001Enter regular hourly pay: 10.00Enter number of hours for the week: 35ID Number: 1001Pay Rate: 10.00Regular Hours: 35.0Overtime Hours: 0Total Hours: 35.00Regular Pay: 10.00Overtime Pay: 0.00Gross Pay: 350.00Deductions: 25.00Net Pay: 325.00>>>
How could I change my syntax?
and the professor mentioned the .105 is means what?
THX
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started