Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

must be typed in python Suppose a worker makes $10 hour with time and a half for

ID: 3789491 • Letter: M

Question

must be typed in python

Suppose a worker makes $10 hour with time and a half for overtime. The number of hours worked for a given week is stored in the variable hours worked. Write a conditional statement that checks to see if hours worked is less than or equal to 40 and if it is, computes the worker's gross weekly pay and stores it in a double variable pay. Write a conditional statement that assigns 0 to the variable b and assigns 1 to the variable if the variable a is less than 10. Write an if-else statement that assigns 20 to the variable y if the variable x is greater than 100. Otherwise, it should assign 0 to the variable y. Write an if-else statement that displays the value of x when x > y. Otherwise it should display the value of y. Write an if-else statement that takes a number of seconds stored in the int variable seconds and if the number is greater than 3600, displays the number of hours in that many r seconds, plus the number of minutes, plus the number of seconds. Otherwise, if the number is greater than 60, the program should display the number of minutes, plus the number of seconds. For example, if the number is 3661, the output should be 1 hour, 1 minute, and 1 second Write a program using (while or For) that reads students grades in different subject and calculates the GPA per student and for the whole class (7 students). Assume (A is 4, B is 3, C is 2, D is 1 and f is 0). Assume each student has two subjects. (you will have nested loop one for each student and the second for each subject for each student)

Explanation / Answer

HI, I have answered first 5 questions.

Please let me know in case of any issue.


if hoursWorked <= 40:
   pay = hoursWorked*10

if a < 10:
   b = 0
   c = 1

if x > 100:
   y = 20
else:
   y = 0

if x > y:
   print x
else:
   print y


if seconds > 3600:
   t = 3600
   h = t/3600
   t = t%3600
   m = t/60
   t = t%60
   print "%d hour, %d minute, %s second"%(h. m, t)
elif seconds > 60:
   m = seconds/60
   print "%d minute, %d second"%(m, seconds%60)