update max015,
This commit is contained in:
BIN
T04/CDS1001.pdf
Normal file
BIN
T04/CDS1001.pdf
Normal file
Binary file not shown.
1445
T04/CDS1001T4Report.ipynb
Normal file
1445
T04/CDS1001T4Report.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1397
T04/CDS1001T4Report_wrong.ipynb
Normal file
1397
T04/CDS1001T4Report_wrong.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1
T04/quotation.md
Normal file
1
T04/quotation.md
Normal file
@@ -0,0 +1 @@
|
||||
HKD200
|
11
T04/test.py
Normal file
11
T04/test.py
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
def genGreetingLetter(customer_name, title, your_name):
|
||||
|
||||
greeting_letter_template = '''
|
||||
Dear {Title} {Customer_Name},
|
||||
Merry Christmas and Happy New Year!
|
||||
Best,
|
||||
{Your_Name}
|
||||
'''.strip().replace('{Customer_Name}', customer_name).replace('{Title}', title).replace('{Your_Name}', your_name)
|
||||
return greeting_letter_template
|
27
T04/test_2_5.py
Normal file
27
T04/test_2_5.py
Normal file
@@ -0,0 +1,27 @@
|
||||
rate1 = 10.0
|
||||
threshold1 = 100
|
||||
discount1 = 0.1
|
||||
|
||||
rate2 = 11.0
|
||||
threshold2 = 200
|
||||
discount2 = 0.3
|
||||
|
||||
def compute_cost_discount(quantity, rate, threshold, discount):
|
||||
cost = rate * quantity
|
||||
if quantity>=threshold:
|
||||
cost = cost*(1.0-discount)
|
||||
return cost
|
||||
|
||||
|
||||
customer = input('Enter customer name: ')
|
||||
quantity = int(input('Enter order quantity: '))
|
||||
|
||||
cost1 = compute_cost_discount(quantity, rate1, threshold1, discount1)
|
||||
cost2 = compute_cost_discount(quantity, rate2, threshold2, discount2)
|
||||
|
||||
lowest_cost = cost1
|
||||
|
||||
if cost2<lowest_cost:
|
||||
lowest_cost = cost2
|
||||
|
||||
print('Lowest Cost for', customer, ':', lowest_cost)
|
19
T04/test_2_6.py
Normal file
19
T04/test_2_6.py
Normal file
@@ -0,0 +1,19 @@
|
||||
def computepay(hours, rate):
|
||||
output = 0
|
||||
hours = int(hours)
|
||||
rate = float(rate)
|
||||
|
||||
if (hours > 40):
|
||||
output = 40*rate + (hours-40)*rate*1.5
|
||||
else:
|
||||
output = hours*rate
|
||||
|
||||
return output
|
||||
|
||||
print('Input:')
|
||||
hours = input('Enter Hours: ')
|
||||
rate = input('Enter Rate: ')
|
||||
|
||||
pay = computepay(hours, rate)
|
||||
print('Output:')
|
||||
print(f"Pay: {pay}")
|
7
T04/test_3_1.py
Normal file
7
T04/test_3_1.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import math
|
||||
|
||||
math.pi = 123321
|
||||
pi = math.pi
|
||||
d = math.sqrt(2)
|
||||
|
||||
print(pi * d)
|
Reference in New Issue
Block a user