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.

48,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Thanks for one’s marvelous posting! I actually enjoyed reading it, you are a great author.
    I will make certain to bookmark your blog and
    will eventually come back sometime soon. I
    want to encourage you continue your great work, have a nice afternoon!

  2. I have been surfing on-line more than 3 hours lately, yet I never found any fascinating article like
    yours. It is lovely value enough for me. In my view, if all web
    owners and bloggers made excellent content material as you did, the web will probably be much more useful than ever before.

  3. Hello there, just became aware of your blog through Google, and
    found that it’s truly informative. I am gonna watch out for brussels.
    I’ll appreciate if you continue this {in future}.
    Many people will be benefited from your writing. Cheers!

  4. Do you mind if I quote a few of your articles as long as I provide credit and sources back to
    your webpage? My blog site is in the very same niche as
    yours and my users would genuinely benefit from some of the information you present here.
    Please let me know if this alright with you.

    Appreciate it!

  5. Hey there! I’ve been reading your weblog for some time now and finally got the courage to
    go ahead and give you a shout out from Kingwood Tx!

    Just wanted to mention keep up the excellent work!

  6. Your method of telling everything in this paragraph is really good, all can without difficulty
    understand it, Thanks a lot.

  7. I have been exploring for a little bit for any high-quality articles or blog posts
    on this sort of house . Exploring in Yahoo I at last stumbled upon this web site.
    Reading this info So i am happy to convey that I have
    an incredibly good uncanny feeling I discovered exactly what I
    needed. I such a lot without a doubt will make certain to do not fail to remember this site and provides it a look
    on a relentless basis.

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

  9. Amazing blog! Do you have any hints for aspiring writers? I’m
    hoping to start my own website soon but I’m a little lost on everything.
    Would you recommend starting with a free platform like WordPress
    or go for a paid option? There are so many choices out there that I’m completely confused
    .. Any suggestions? Cheers!

  10. Right here is the perfect web site for anybody who wants
    to understand this topic. You know a whole lot its almost hard to argue with you (not that I
    actually would want to…HaHa). You definitely put a brand new spin on a topic which has been discussed for years.

    Wonderful stuff, just excellent!

  11. I need to to thank you for this fantastic read!! I definitely loved every little bit of it.
    I have you saved as a favorite to check out new stuff you post…

  12. I got this site from my pal who told me regarding this site and now this time I am browsing this site
    and reading very informative articles here.

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

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

  15. An outstanding share! I have just forwarded this onto a
    friend who had been conducting a little homework on this.
    And he actually ordered me dinner simply because I stumbled upon it for him…
    lol. So allow me to reword this…. Thanks for the meal!!
    But yeah, thanks for spending time to discuss this subject here on your internet site.

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

  17. Hello there! This blog post couldn’t be written much better!
    Looking at this post reminds me of my previous roommate!
    He continually kept talking about this. I’ll forward this information to him.
    Pretty sure he’s going to have a very good read.
    Thanks for sharing!

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

  19. Hello I am so delighted I found your blog page, I really found you by accident, while I was browsing on Digg for something
    else, Anyhow I am here now and would just like to say thanks
    a lot for a fantastic post and a all round interesting blog (I also love the theme/design), I
    don’t have time to look over it all at the moment
    but I have saved it and also included your RSS feeds, so when I have
    time I will be back to read more, Please do keep up the awesome
    work.

  20. Great blog! Is your theme custom made or did you download it
    from somewhere? A theme like yours with a few simple tweeks
    would really make my blog shine. Please let me know where you got your design. Cheers

  21. I have been exploring for a bit for any high quality
    articles or blog posts in this sort of house
    . Exploring in Yahoo I finally stumbled upon this website.
    Studying this information So i’m satisfied to show that I have a
    very excellent uncanny feeling I came upon exactly what I needed.
    I such a lot no doubt will make sure to do not fail to remember this website
    and give it a look on a relentless basis.

  22. I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you?
    Plz answer back as I’m looking to design my own blog and would
    like to know where u got this from. many thanks

  23. I was recommended this blog by way of my cousin. I’m now not positive whether this submit
    is written via him as nobody else realize such designated about my trouble.
    You are amazing! Thank you!

Comments are closed.