-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate_fashion.py
27 lines (22 loc) · 915 Bytes
/
date_fashion.py
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
#CodingBat - Python
#date_fashion
#You and your date are trying to get a table at a restaurant. The parameter
#"you" is the stylishness of your clothes, in the range 0..10, and "date" is the
#stylishness of your date's clothes. The result getting the table is encoded as
#an int value with 0=no, 1=maybe, 2=yes. If either of you is very stylish, 8 or
#more, then the result is 2 (yes). With the exception that if either of you has
#style of 2 or less, then the result is 0 (no). Otherwise the result is 1 (maybe).
# date_fashion(5, 10) → 2
# date_fashion(5, 2) → 0
# date_fashion(5, 5) → 1
def date_fashion(you, date):
if (you >= 8 and date <= 2) or (you <= 2 and date >= 8) or (you <= 2 or date <= 2):
return 0
elif (you >= 8 or date >= 8):
return 2
else:
return 1
#To check:
#print(date_fashion(5, 10))
#print(date_fashion(5, 2))
#print(date_fashion(5, 5))