ano po kulang, need kasi ng negative to have error once nag print nang -100 kailangan error ang Lumabas. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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))

14th May 2023, 7:30 AM
Jhoy Lopez
Jhoy Lopez - avatar
2 Answers
+ 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)
14th May 2023, 9:08 AM
Bob_Li
Bob_Li - avatar
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
14th May 2023, 7:53 AM
Ausgrindtube
Ausgrindtube - avatar