forked from imtiazahmad007/PythonCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment_02.py
More file actions
50 lines (20 loc) · 790 Bytes
/
assignment_02.py
File metadata and controls
50 lines (20 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Assignment 2
"""
Create a method called pay_extra that accepts 2 parameters:
working, and hour. This method will be used to decide whether
an employee will receive extra pay or not. If an employee is working
during the hrs of 8pm until 8am in the morning, that means they
should be paid extra. In that situation the method should return true,
otherwise it should return false.
NOTE: the hour parameter should be from 0-23.
So 8AM is hour 8, and 8PM is hour 20.
Example:
pay_extra(True, 11) -> false
pay_extra(False, 5) -> false
pay_extra(True, 6) -> true
"""
def pay_extra(working, hour):
return (working and (hour < 8 or hour > 20))
# Solution
# def pay_extra(working, hour):
# return (working and (hour < 8 or hour > 20))