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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:00, EhHannuh6865
Let r be a robotic arm with a fixed base and seven links. the last joint of r is a prismatic joint, the other ones are revolute joints. give a set of parameters that determines a placement of r. what is the dimension of the configuration space resulting from your choice of parameters?
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, caromaybelline71
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, sha273
Which option completes the explanation for conflict of interest in an organization
Answers: 1
image
Computers and Technology, 24.06.2019 13:10, Briannas5022
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
You know the right answer?
Suppose we are writing a program to calculate the gross pay of workers in a grocery store.
Wh...

Questions in other subjects:

Konu
Biology, 22.04.2020 17:26
Konu
Spanish, 22.04.2020 17:26