21 lines
650 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def hitung_beban_maksimum(berat_keledai_kg):
"""
Menghitung beban maksimum yang dapat dibawa keledai.
Rata-rata keledai dapat membawa 20%30% dari berat badannya.
"""
if berat_keledai_kg <= 0:
raise ValueError("Berat keledai harus lebih dari 0 kg.")
beban_min = berat_keledai_kg * 0.2
beban_maks = berat_keledai_kg * 0.3
return beban_min, beban_maks
def main():
berat = float(input("Masukkan berat keledai (kg): "))
beban_min, beban_maks = hitung_beban_maksimum(berat)
print(f"Beban ideal yang bisa dibawa: {beban_min:.2f} kg - {beban_maks:.2f} kg")
if __name__ == "__main__":
main()