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)

120 thoughts on “Contoh Soal Pemrograman – Menghitung Biaya Parkir

  1. Ahaa, its nice dialogue concerning this piece of
    writing at this place at this weblog, I have read all that, so at this time me also commenting at this place.

  2. Howdy I am so grateful I found your blog page, I really found you by mistake, while
    I was researching on Aol for something else, Anyways I am here now and would
    just like to say thanks for a fantastic post and a all round entertaining blog
    (I also love the theme/design), I don’t have time to browse it all at the moment but I have book-marked it
    and also added your RSS feeds, so when I have time I will be back to read
    much more, Please do keep up the great job. http://antiibioticsland.com/Cephalexin.htm

  3. A motivating discussion is definitely worth comment. I think that you should publish more
    on this topic, it may possibly not be described as
    a taboo matter but generally folks don’t speak about such issues.
    To the next! Best wishes!!

    Here is my blog – NorbertYTiro

  4. Howdy just wanted to give you a quick heads up.
    The words in your content seem to be running off the screen in Safari.

    I’m not sure if this is a formatting issue or something to do with browser compatibility but I thought I’d post to let you know.
    The layout look great though! Hope you get the issue fixed soon.
    Many thanks

  5. I will immediately take hold of your rss as I
    can’t in finding your email subscription hyperlink or e-newsletter service.
    Do you’ve any? Kindly let me know in order that
    I may just subscribe. Thanks.

  6. Ahaa, its pleasant conversation about this post at this place
    at this blog, I have read all that, so at this time me also commenting at this place.

  7. Hey there I am so grateful I found your webpage, I really found you by error, while I was searching on Digg for
    something else, Regardless I am here now and would just like to say thanks for a remarkable post and a all round entertaining blog (I
    also love the theme/design), I don’t have time to read it all at the
    moment but I have book-marked it and also added in your RSS feeds,
    so when I have time I will be back to read a great deal
    more, Please do keep up the fantastic job.

Leave a Reply

Your email address will not be published. Required fields are marked *