0
ano po kulang, need kasi ng negative to have error once nag print nang -100 kailangan error ang Lumabas.
order=float(input("Enter total of orders")) ship_fee=0 if order<50: ship_fee=5 elif order >=50 and order <=100: ship_fee=2 else: ship_fee=0 total_amount= order + ship_fee print(" total amount of orders is: ₱ " + str(total_amount))
2 Réponses
+ 1
when you need to compare values, you often compare booleans, strings or ints
.
comparing floats is not recommended because of floating point errors.
you should cast your input as int
order = int(input(Enter total orders"))
If you use comma, there is no need to cast to string.
print("Total amount is: ₱", total_amount)
0
Why is your order a float when it looks like you would like an int?
Also, please the following for tags:
https://code.sololearn.com/W3uiji9X28C1/?ref=app