|
2 | 2 | print("Which package do you have A, B, or C? : ") |
3 | 3 | package =str(input()) |
4 | 4 |
|
5 | | -if(package =='A'orpackage=='B'orpackage=='C'): |
| 5 | +ifpackage in {'A', 'B', 'C'}: |
6 | 6 | print("How many hours were used:") |
7 | 7 | hours=int(input()) |
8 | 8 | if(hours > 744 or hours < 0): |
9 | 9 | print("Hours cannot be greater than 744 or less than 0!! \n\n") |
10 | 10 | print("Enter hours again: ") |
11 | 11 | hours=int(input()) |
12 | 12 |
|
13 | | -if(package == "A"): |
14 | | - |
| 13 | +if package == "A": |
15 | 14 | limit = 9.95; |
16 | | - |
17 | | - if(hours < 10): |
18 | | - total = limit; |
19 | | - |
20 | | - else: |
21 | | - total = ((hours - 10) * 2) + limit |
22 | 15 |
|
| 16 | + total = limit if (hours < 10) else ((hours - 10) * 2) + limit |
23 | 17 | print("The amount due is: $%.2f"%total) |
24 | 18 |
|
25 | | -if(package == 'B'): |
26 | | - |
| 19 | +elif package == 'B': |
27 | 20 | limit = 14.95; |
28 | | - if(hours < 20): |
29 | | - total = limit; |
30 | | - else: |
31 | | - total = ((hours - 20) * 1) + limit; |
32 | | - |
| 21 | + total = limit if (hours < 20) else ((hours - 20) * 1) + limit |
33 | 22 | print("The amount due is: $%.2f"%total) |
34 | 23 |
|
35 | | -if(package == 'C'): |
36 | | - |
| 24 | +elif package == 'C': |
37 | 25 | limit = 19.95; |
38 | 26 | total = limit; |
39 | 27 | print("The amount due is: $%.2f"%total) |
0 commit comments