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. fantastic post, very informative. I wonder why the opposite
    specialists of this sector do not understand this.

    You must proceed your writing. I am confident, you’ve a great readers’
    base already!

  2. Nice post. I was checking continuously this blog and I’m impressed!
    Extremely helpful information particularly the last part 🙂 I care for such information much.
    I was seeking this particular info for a very long time.
    Thank you and best of luck.

  3. obviously like your website but you need to take a look at
    the spelling on several of your posts. Many of
    them are rife with spelling issues and I in finding it very troublesome to inform the reality on the other hand I will surely come again again.

  4. Hey there I am so glad I found your web site, I
    really found you by accident, while I was browsing on Askjeeve for something else, Nonetheless I
    am here now and would just like to say cheers for a fantastic post and a all
    round enjoyable blog (I also love the theme/design), I don’t have time to read it all at the minute but I have bookmarked it and
    also added your RSS feeds, so when I have time I will be back to read
    a great deal more, Please do keep up the superb work.

Comments are closed.