Contoh Soal Pemrograman – Pola Segitiga Siku-siku

Pemrograman Python

Pada posting sebelumnya sudah dicontohkan soal pemrograman dalam bahasa Python. Kali ini, akan ditampilkan lagi contoh berikutnya.

Soal:
Buatlah program Python untuk menampilkan pola segitiga siku-siku menggunakan for … in.

Jawab:

Pola 1

*  *  *  *  *  *
*  *  *  *  *
*  *  *  *
*  *  *
*  *
*

Jawab:

siku_siku_1.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(0, tinggi-baris):
        print("*", end=" ")
    print("")

 

Pola 2

*
*  *
*  *  *
*  *  *  *
*  *  *  *  *
*  *  *  *  *  *

Jawab:

siku_siku_2.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(0, baris+1):
        print("*", end=" ")
    print("")

Pola 3

               *
            *  *
         *  *  *
      *  *  *  *
   *  *  *  *  *
*  *  *  *  *  *

Jawab:

siku_siku_3.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(1, tinggi-baris):
        print(" ", end=" ")
    for bintang in range(0, baris+1):
        print("*", end=" ")
    print("")

Demikian contoh pola segitiga dalam pemrograman Python. Semoga bermanfaat.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. Write more, thats all I have to say. Literally,
    it seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why throw away your intelligence on just posting videos to your weblog when you could
    be giving us something enlightening to read?

  2. Excellent blog you have got here.. It’s difficult to find good quality
    writing like yours these days. I seriously appreciate people like
    you! Take care!!

  3. Hi there to every body, it’s my first pay a quick visit of
    this web site; this blog carries amazing and in fact fine
    information in favor of readers.

  4. Pretty part of content. I just stumbled upon your site and in accession capital to assert that
    I acquire in fact loved account your weblog posts. Anyway I will
    be subscribing in your feeds and even I achievement you get entry to persistently rapidly.

  5. fantastic put up, very informative. I’m wondering why the opposite experts of this sector do not understand this.
    You must proceed your writing. I am confident, you have a great readers’ base already!

  6. Today, I went to the beach with my children. I found a sea
    shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.”
    She placed the shell to her ear and screamed. There was a hermit
    crab inside and it pinched her ear. She never wants to go back!
    LoL I know this is entirely off topic but I
    had to tell someone!

  7. I was curious if you ever considered changing the layout of
    your blog? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two images.
    Maybe you could space it out better?

  8. Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
    Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

  9. Hello, its pleasant piece of writing on the topic of media
    print, we all be familiar with media is a wonderful source of data.

  10. It’s truly very complicated in this full of activity life to listen news
    on TV, so I simply use world wide web for that reason, and take
    the hottest news.

  11. Pretty section of content. I just stumbled upon your blog and
    in accession capital to assert that I acquire in fact enjoyed account your blog posts.
    Anyway I will be subscribing to your feeds and even I achievement you
    access consistently quickly.

  12. I’m impressed, I must say. Rarely do I come across a
    blog that’s both equally educative and engaging, and without a doubt, you have hit the nail on the
    head. The problem is something too few people are speaking
    intelligently about. Now i’m very happy I found this in my search for something concerning this.

  13. What i don’t understood is in reality how you’re now not actually a lot more
    smartly-preferred than you may be right now. You’re very intelligent.

    You recognize therefore significantly in the case
    of this subject, made me individually imagine it from so many numerous angles.
    Its like women and men don’t seem to be fascinated unless it’s one thing to do with
    Girl gaga! Your individual stuffs nice. At all times deal with it up!

  14. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog?
    My blog site is in the very same area of interest
    as yours and my visitors would truly benefit from a lot of the information you provide here.
    Please let me know if this ok with you. Regards!

  15. Hello! Do you use Twitter? I’d like to follow you if that
    would be okay. I’m absolutely enjoying your blog and look forward to new updates.

  16. Admiring the dedication you put into your blog
    and detailed information you provide. It’s great to
    come across a blog every once in a while that isn’t the same out of date rehashed material.
    Wonderful read! I’ve bookmarked your site and I’m adding your RSS feeds to my
    Google account.

  17. I like the helpful info you provide in your articles.
    I’ll bookmark your weblog and check again here frequently.
    I’m quite certain I will learn a lot of new stuff right here!
    Good luck for the next!

  18. With havin so much content and articles do you ever run into
    any issues of plagorism or copyright violation? My site has a lot of completely unique
    content I’ve either authored myself or outsourced but it appears a lot of
    it is popping it up all over the web without my agreement.
    Do you know any techniques to help protect against content from being stolen? I’d certainly appreciate it.

  19. Today, I went to the beach front with my kids.
    I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed
    the shell to her ear and screamed. There was a hermit crab inside and it pinched
    her ear. She never wants to go back! LoL I know this is entirely
    off topic but I had to tell someone!

  20. Hi there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community
    in the same niche. Your blog provided us beneficial information to work
    on. You have done a wonderful job!

  21. I don’t know if it’s just me or if perhaps everybody else encountering problems with your site.
    It appears as if some of the written text on your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them as well?
    This may be a issue with my browser because I’ve had this happen previously.
    Cheers

  22. Somebody essentially help to make severely posts I would
    state. That is the first time I frequented your web page and thus far?

    I surprised with the analysis you made to create this
    particular submit extraordinary. Excellent process!

Comments are closed.