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.

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

  1. Hello there! Do you use Twitter? I’d like to follow you
    if that would be ok. I’m definitely enjoying your blog and look forward to new updates.

  2. I was curious if you ever considered changing the page 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 1 or 2 images. Maybe you could space it out better?

  3. Incredible! This blog looks just like my old one! It’s on a completely different subject but it has pretty much the same layout and design. Outstanding choice of colors!

  4. I do not even understand how I ended up here, however I assumed
    this publish was great. I do not understand who you are however definitely you’re going to
    a famous blogger in the event you are not already.
    Cheers!

  5. Hi! Someone in my Facebook group shared this site with us
    so I came to give it a look. I’m definitely enjoying the information. I’m bookmarking
    and will be tweeting this to my followers! Great blog and wonderful style
    and design.

  6. After I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I get 4 emails with the exact same comment.

    Is there a means you are able to remove me from that service?
    Cheers!

  7. Does your site have a contact page? I’m having a tough time locating it but,
    I’d like to send you an email. I’ve got some creative ideas for your
    blog you might be interested in hearing. Either way, great blog
    and I look forward to seeing it expand over time.

  8. You should take part in a contest for one of the highest quality blogs on the internet.
    I am going to recommend this site!

  9. I loved as much as you will receive carried out right here.

    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an shakiness over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the
    same nearly a lot often inside case you shield this increase.

  10. Great blog! Do you have any hints for aspiring writers?

    I’m hoping to start my own blog soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are so
    many options out there that I’m totally confused .. Any
    tips? Cheers!

  11. I was wondering if you ever thought of changing the page layout of your site?
    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 pictures. Maybe you could space it out better?

  12. I just couldn’t depart your site prior to suggesting that
    I extremely loved the usual info an individual provide for your visitors?
    Is going to be again often to investigate cross-check new posts

  13. obviously like your web site but you need to test the
    spelling on quite a few of your posts. A number of them are rife with spelling problems and I in finding it very troublesome to tell the truth on the other hand I will surely come back again.

  14. Right here is the perfect web site for anybody who hopes to understand this topic.
    You realize a whole lot its almost tough to argue with you (not that I personally will need to…HaHa).
    You certainly put a fresh spin on a topic that has been discussed for
    ages. Wonderful stuff, just great!

  15. Howdy, i read your blog from time to time and i own a similar one and i was just wondering if you get
    a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise?
    I get so much lately it’s driving me crazy so
    any assistance is very much appreciated.

  16. I got this web site from my pal who shared with me about this web site and
    now this time I am visiting this web page and reading
    very informative articles or reviews at this time.

  17. excellent post, very informative. I ponder why the opposite experts of
    this sector do not notice this. You must continue your writing.

    I am sure, you’ve a great readers’ base already!

  18. great points altogether, you simply won a new reader.
    What would you suggest in regards to your submit that
    you made a few days in the past? Any positive?

  19. Hi, i think that i noticed you visited my web site so i got here to return the desire?.I am attempting to find issues to improve
    my site!I suppose its adequate to make use of a few of your concepts!!

  20. Hi to all, how is the whole thing, I think every one is getting more from this web site,
    and your views are fastidious for new visitors.

  21. Right now it sounds like Movable Type is the preferred blogging platform out there right
    now. (from what I’ve read) Is that what you are using on your blog?

Comments are closed.