Contoh Soal Pemrograman – Menghitung Biaya Parkir

Pemrograman Python

Berikut adalah contoh soal menggunakan bahasa pemrograman Python.

Buatlah program Python untuk menghitung biaya parkir di sebuah rumah sakit berdasarkan lama parkir. Lama parkir dihitung dari selisih jam masuk dan jam keluar. Jam masuk dan jam keluar diisi 1-24. Biaya parkir adalah Rp. 2.000,- per jam.

Contoh tampilan program:
Jam masuk    : 10 (input)
Jam keluar     : 14 (input)
Lama parkir  : 4 jam (keluaran program)
Biaya parkir  : 8000 (keluaran program)

Berikut kode program yang dapat dibuat untuk menyelesaikan soal tersebut.


jam_masuk = int(input("Jam Masuk  : "))
jam_keluar = int(input("Jam Keluar  : "))

lama_parkir = jam_keluar - jam_masuk
biaya_parkir = lama_parkir * 2000

print("Lama Parkir : ", lama_parkir)
print("Biaya Parkir : ", biaya_parkir)

4,175 thoughts on “Contoh Soal Pemrograman – Menghitung Biaya Parkir

  1. hello there and thank you for your information – I’ve certainly picked up
    anything new from right here. I did however expertise a few technical points using this site,
    as I experienced to reload the web site a
    lot of times previous to I could get it to load correctly.

    I had been wondering if your web host is OK? Not that I’m complaining, but sluggish loading instances times will very frequently affect your placement in google and could
    damage your quality score if advertising and marketing with Adwords.
    Well I am adding this RSS to my e-mail and can look out
    for a lot more of your respective intriguing
    content. Ensure that you update this again soon.

Comments are closed.