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. I’m impressed, I have to admit. Seldom do I come across a blog that’s both
    equally educative and entertaining, and without a doubt,
    you have hit the nail on the head. The problem is an issue
    that too few people are speaking intelligently about.
    Now i’m very happy I stumbled across this during my search for something concerning
    this.

  2. Hello my friend! I wish to say that this article is amazing, nice written and include almost all vital infos.
    I’d like to look extra posts like this .

  3. The other day, while I was at work, my cousin stole my iphone and tested to see if it can survive a forty foot
    drop, just so she can be a youtube sensation. My apple ipad is now broken and she
    has 83 views. I know this is entirely off topic but
    I had to share it with someone!

  4. I’m amazed, I have to admit. Rarely do I come across a blog that’s both educative and amusing, and let me tell you, you have hit
    the nail on the head. The problem is an issue that too few folks are
    speaking intelligently about. I’m very happy that I came
    across this in my search for something relating to
    this.

  5. Hola! I’ve been reading your weblog for a long time now and finally got the courage to
    go ahead and give you a shout out from Houston Tx! Just wanted to tell you keep up the good job!

  6. Incredible! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the
    same layout and design. Great choice of colors!

  7. Whats up this is kinda of off topic but I was wanting to know if blogs use
    WYSIWYG editors or if you have to manually code with
    HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  8. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more pleasant for me
    to come here and visit more often. Did you hire out a developer to create your theme?

    Superb work!

  9. of course like your web-site but you need to check the spelling on quite a few of
    your posts. Several of them are rife with spelling problems and I find it very bothersome to tell the reality nevertheless I
    will surely come back again.

  10. I don’t even know how I ended up here, but I thought this post was good.
    I do not know who you are but certainly you are going to a famous blogger if you aren’t already ;
    ) Cheers!

  11. Very nice post. I just stumbled upon your blog and wanted to say that I have truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your rss feed and I
    hope you write again very soon!

  12. Hello there! This article couldn’t be written any better!
    Going through this post reminds me of my previous roommate!
    He continually kept talking about this. I am going to forward this post to him.
    Fairly certain he’ll have a very good read. I appreciate you for
    sharing!

  13. It’s not my first time to go to see this web
    page, i am browsing this web page dailly and obtain good facts
    from here daily.

  14. What i do not understood is in reality how you are now not
    actually a lot more well-appreciated than you may be now.
    You are so intelligent. You recognize thus significantly
    on the subject of this topic, produced me individually consider
    it from numerous varied angles. Its like women and men are not interested until it is one thing to accomplish with Woman gaga!
    Your individual stuffs great. At all times care for it
    up!

  15. Fantastic blog! Do you have any suggestions for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose 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 suggestions? Bless you!

  16. Wonderful beat ! I would like to apprentice while you amend your site, how can i subscribe for a blog web site?
    The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear
    concept

  17. of course like your web site however you need to take a look at the
    spelling on quite a few of your posts. Many of them are
    rife with spelling problems and I to find it very
    bothersome to tell the truth nevertheless I will definitely come back again.

  18. Hi there just wanted to give you a quick heads up
    and let you know a few of the pictures aren’t loading correctly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different internet browsers and both show the same results.

  19. I like the helpful information you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I’m quite sure I will learn many new stuff right here!
    Best of luck for the next!

  20. I do not know if it’s just me or if everyone else encountering issues
    with your site. It appears like some of the
    written text on your content are running off the screen. Can somebody else please provide feedback and
    let me know if this is happening to them too?

    This might be a problem with my internet browser because I’ve had this happen before.
    Kudos

  21. Hi there, this weekend is fastidious in support of me, for the reason that this occasion i am reading this enormous informative piece of
    writing here at my house.

  22. I think that is among the such a lot important info for me.
    And i am satisfied reading your article. But wanna observation on few normal issues, The web site taste is perfect,
    the articles is truly great : D. Just right process, cheers

Comments are closed.