-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathเลขไทยปะโยด.py
52 lines (52 loc) · 2.73 KB
/
เลขไทยปะโยด.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""เลขไทยมีประโยชน์"""
def main():
"""Print ค่าบัตรเข้าน้ำตก กรณีฟรี,เด็ก"""
nation_t = input()
# เช็คว่าเป็นคนไทยรึเปล่า?
if nation_t == "N":
nation_w = input()
else:
nation_w = "" # เป็นstrอะไรก็ได้ เพราะไม่ตรงเงื่อนไขข้างล่างแน่นอน
age = int(input())
coupon_h = input()
# เช็คว่ามีคูปองรึเปล่า?
if coupon_h == "Y":
coupon_m = int(input())
else:
coupon_m = 0 # ไม่มีส่วนลด
# เช็คราคาตั๋ว
if 0 <= age <= 10 or age > 60:
print("%.2f" %0)
elif 10 < age <= 20 and nation_t == "Y" and coupon_h == "N":
print("%.2f" %(20))
elif 10 < age <= 20 and nation_t == "Y" and coupon_h == "Y":
print("%.2f" %(20 * (1 - (coupon_m / 100))))
elif 10 < age <= 20 and nation_t == "N" and (nation_w == "Vietnam" \
or nation_w == "Singapore" or nation_w == "India") and coupon_h == "N":
print("%.2f" %(20 * 5 * 0.5))
elif 10 < age <= 20 and nation_t == "N" and coupon_h == "N":
print("%.2f" %(20 * 5))
elif 10 < age <= 20 and nation_t == "N" and (nation_w == "Vietnam" \
or nation_w == "Singapore" or nation_w == "India") and coupon_h == "Y":
print("%.2f" %(20 * 5 * 0.5 *(1 - (coupon_m / 100))))
elif 10 < age <= 20 and nation_t == "N" and coupon_h == "Y":
print("%.2f" %(20 * 5 * (1 - (coupon_m / 100))))
else:
tuo(age, nation_t, nation_w, coupon_h, coupon_m)
def tuo(age, nation_t, nation_w, coupon_h, coupon_m):
"""Print ค่าบัตรเข้าน้ำตก กรณีผู้ใหญ่"""
if 20 < age <= 60 and nation_t == "Y" and coupon_h == "N":
print("%.2f" %(40))
elif 20 < age <= 60 and nation_t == "Y" and coupon_h == "Y":
print("%.2f" %(40 * (1 - (coupon_m / 100))))
elif 20 < age <= 60 and nation_t == "N" and (nation_w == "Vietnam" \
or nation_w == "Singapore" or nation_w == "India") and coupon_h == "N":
print("%.2f" %(40 * 5 *0.5))
elif 20 < age <= 60 and nation_t == "N" and coupon_h == "N":
print("%.2f" %(40 * 5))
elif 20 < age <= 60 and nation_t == "N" and (nation_w == "Vietnam" \
or nation_w == "Singapore" or nation_w == "India") and coupon_h == "Y":
print("%.2f" %(40 * 5 * 0.5 * (1 - (coupon_m / 100))))
elif 20 < age <= 60 and nation_t == "N" and coupon_h == "Y":
print("%.2f" %(40 * 5 * (1 - (coupon_m / 100))))
main()