Professional Documents
Culture Documents
if party < 6:
tip_percentage = 0.15
tip_percentage = 0.18
tip_percentage = 0.20
else:
tip_percentage = 0.25
bill = 100.0
party = 7
tip = 0.18
my_tip_calc(100.0,7)
Câu 2
if operation == "plus" :
result = a + b
result = a - b
result = a*b
result = a/b
result = a**b
else:
result = "None"
return result
a = 4
b = 5
operation = "mult","plus","minus","div","pow"
r2 =my_mult_operation(a, b,"plus")
print(r1,r2,r3,r4,r5)
Câu 8
import math
def my_n_roots(a,b,c) :
if delta > 0 :
elif delta == 0 :
root = -b/(2*a)
return 1,[root]
a = 1
b = 2
c = -1
n_root = my_n_roots(a,b,c)
print(n_root)
Câu 3
return "outside"
elif x == 0 or y == 0 or x + y == 1:
return "border"
else:
return "inside"
x = 4
y = 5
my_inside_triangle(4,5)