-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeginner - Arithmetic
More file actions
23 lines (19 loc) · 888 Bytes
/
Beginner - Arithmetic
File metadata and controls
23 lines (19 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Sample inputs (# note: The values given in the prefix code(grey) will be changed by the autograder according to the testcase while running them.
a = 5
b = 6
price, discount_percent = 80, 5.75
total_mins = 470
# <eoi>
output1 = a+b # int: sum of a and b
output2 = 2*(a+b) # int: twice the sum of a and b
output3 = abs(a-b) # int: absolute difference between a and b
output4 = abs((a+b) - (a*b)) # int: absolute difference between sum and product of a and b
# Find discounted price given price and discount_percent
# input variables : price: int, discount_percent: float
discounted_price = (1-discount_percent/100)*price # float
# Round the discounted_price
rounded_discounted_price = round(discounted_price) # int
# Find hrs and mins given the total_mins
# input variables : total_mins
hrs = total_mins//60 # int: hint: think about floor division operator
mins = total_mins%60 # int