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 forin.

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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. 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!

  2. 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!

  3. 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?

  4. 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.

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

  6. 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.

  7. 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.

  8. 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.

  9. 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!

  10. 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!

  11. 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.

  12. 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.

  13. 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!

  14. 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.

  15. 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!

  16. 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!

  17. 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

  18. 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!

  19. Hello this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you
    have to manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  20. It’s a pity you don’t have a donate button!
    I’d certainly donate to this excellent blog!
    I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will share this blog with my Facebook group.
    Chat soon!

  21. Great web site you have got here.. It’s hard to find good quality writing like yours these days.
    I truly appreciate people like you! Take care!!

  22. I’m amazed, I must say. Rarely do I encounter a blog
    that’s both equally educative and interesting, and without a doubt, you’ve hit the nail on the head.
    The issue is something which not enough men and women are speaking intelligently about.
    Now i’m very happy I found this in my hunt for something regarding this.

Comments are closed.