subject

Suppose we are writing a program to calculate the gross pay of workers in a grocery store.
Which of the following Python programs will calculate each worker’s gross pay until the user does not answer ‘y’ to the question "Calculate another gross pay"?

A.
keep_going = input('Calculate another gross pay? [Enter y for yes] ')
while keep_going == 'y':
hours = float(input('How many hours did this worker work? '))
gross_pay = hours * 10
print('Gross pay:', gross_pay)

B.
keep_going = 'y'
if keep_going == 'y':
hours = float(input('How many hours did this worker work? '))
gross_pay = hours * 10
print('Gross pay:', gross_pay)
keep_going = input('Calculate another gross pay? [Enter y for yes] ')

C.
while keep_going == 'y':
hours = float(input('How many hours did this worker work? '))
gross_pay = hours * 10
print('Gross pay:', gross_pay)
keep_going = input('Calculate another gross pay? [Enter y for yes] ')

D.
keep_going = 'y'
while keep_going == 'y':
hours = float(input('How many hours did this worker work? '))
gross_pay = hours * 10
print('Gross pay:', gross_pay)
keep_going = input('Calculate another gross pay? [Enter y for yes] ')

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
What does a cascading style sheet resolve a conflict over rules for an element? a. the rule affecting the most content wins b. the rule affecting the most content loses c. the rule with the most specific selector loses d. the rule with the most specific selector wins
Answers: 2
question
Computers and Technology, 24.06.2019 11:30
Why is body language an important factor in a business meeting
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
You know the right answer?
Suppose we are writing a program to calculate the gross pay of workers in a grocery store.
Wh...
Questions
question
Mathematics, 22.12.2021 06:00
Questions on the website: 13722363