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. Hi are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own.
    Do you require any coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  2. Hi there! This post could not be written any better!
    Looking at this article reminds me of my previous roommate!
    He always kept preaching about this. I’ll send this post to him.
    Pretty sure he will have a great read. Thank you for sharing!

  3. Oh my goodness! Awesome article dude! Thank you, However I am encountering troubles with your RSS.
    I don’t understand the reason why I am unable to subscribe to it.
    Is there anyone else having identical RSS problems? Anybody who
    knows the solution can you kindly respond? Thanx!!

  4. Admiring the time and effort you put into your website and detailed information you present.
    It’s great to come across a blog every once in a while that isn’t the same old rehashed information. Wonderful read!
    I’ve saved your site and I’m adding your RSS feeds to my Google account.

  5. I appreciate, cause I found exactly what I used
    to be looking for. You’ve ended my 4 day lengthy hunt!
    God Bless you man. Have a nice day. Bye

  6. It’s amazing to go to see this website and reading the views of all colleagues about this article, while I am also
    keen of getting knowledge.

  7. It’s a pity you don’t have a donate button! I’d definitely donate to this fantastic blog!
    I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to new updates and will talk about this website with my Facebook group.
    Talk soon!

  8. We stumbled over here from a different page and thought I might check things out.
    I like what I see so now i am following you. Look forward
    to looking at your web page again.

Comments are closed.