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. I’m very pleased to find this site. I want to to thank you for
    your time for this fantastic read!! I definitely enjoyed every bit of
    it and i also have you book-marked to see new things on your blog.

  2. I used to be recommended this blog through my cousin. I am no longer
    sure whether this put up is written by means of him as
    nobody else know such designated approximately my difficulty.
    You are amazing! Thanks!

  3. This design is spectacular! You obviously know how to keep
    a reader amused. Between your wit and your videos, I was almost moved to
    start my own blog (well, almost…HaHa!) Wonderful job. I really enjoyed what you had to say,
    and more than that, how you presented it.
    Too cool!

  4. Amazing issues here. I am very satisfied to look your post.
    Thanks so much and I am looking ahead to touch you. Will you
    kindly drop me a e-mail?

  5. We’re a group of volunteers and starting a new scheme in our community.
    Your web site offered us with valuable information to work on. You have done an impressive job and our whole
    community will be grateful to you.

  6. Hello my family member! I wish to say that this post is amazing, great written and include almost all important infos.

    I’d like to look extra posts like this .

  7. Hmm is anyone else encountering problems with the images on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any suggestions would be greatly appreciated.

  8. It’s nearly impossible to find educated people about this topic, however, you seem like you know what you’re talking about!
    Thanks

Comments are closed.