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,187 thoughts on “Contoh Soal Pemrograman – Menghitung Biaya Parkir

  1. We are a bunch of volunteers and starting a brand new scheme in our community.
    Your site provided us with useful info to work on. You have performed an impressive
    task and our whole neighborhood will likely be thankful to you.

  2. I’ve been surfing on-line more than 3 hours nowadays, yet
    I never discovered any fascinating article like yours. It is pretty worth enough for me.
    In my view, if all site owners and bloggers made excellent content
    as you probably did, the internet might be much more useful than ever before.

  3. It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog!

    I guess for now i’ll settle for bookmarking and adding your RSS
    feed to my Google account. I look forward to fresh updates and will talk about this site with my Facebook group.
    Chat soon!

Comments are closed.