- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodingBatExamples.py
More file actions
Latest commit
42 lines (32 loc) · 683 Bytes
/
Copy pathCodingBatExamples.py
File metadata and controls
42 lines (32 loc) · 683 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
#!/usr/bin/env python
"""
CodingBat Examples:
"""
##Warmup-1 > sleep_in
#sample 1:
defsleep_in(weekday, vacation):
ifvacation:
returnTrue
ifnotweekday:
returnTrue
returnFalse
#sample 2:
defsleep_in(weekday, vacation):
ifnotweekdayorvacation:
returnTrue
else:
returnFalse
#sample 3:
defsleep_in(weekday, vacation):
# parentheses not required...
return (notweekday) orvacation
## Warmup-1 > diff21:
defdiff21(n):
result=n-21
ifresult>0:
returnresult*2
else:
return-result
## Warmup-1 > makes10:
defmakes10(a, b):
returna==10orb==10ora+b==10