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. Terrific work! That is the kind of info that are
    supposed to be shared across the web. Shame on the search engines for now not positioning this
    publish upper! Come on over and discuss with my website .

    Thank you =)

  2. Hey There. I found your blog using msn. This is a really well written article.
    I’ll make sure to bookmark it and return to read more of your useful information. Thanks
    for the post. I will certainly return.

  3. I was recommended this website by my cousin. I’m not sure whether this post is written by him as nobody else know such
    detailed about my difficulty. You’re amazing! Thanks!

  4. I like the valuable information you supply in your articles.
    I’ll bookmark your blog and test again here frequently.

    I am moderately certain I will be told plenty
    of new stuff right here! Good luck for the next!

  5. I was wondering if you ever considered changing the layout of your website?
    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 2 images. Maybe you could space it out better?

  6. Hey there! I’ve been reading your blog for a while now and finally got the courage to go ahead and give
    you a shout out from Porter Tx! Just wanted to tell you keep
    up the excellent work!

  7. A motivating discussion is definitely worth comment. I do believe that you ought to write
    more on this subject, it might not be a taboo subject but typically
    folks don’t talk about these topics. To the next!
    Kind regards!!

  8. Wonderful blog you have here but I was wondering if you knew of any community forums that cover the same topics discussed in this article?
    I’d really love to be a part of online community where I can get advice
    from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know. Bless you!

  9. Amazing blog! Do you have any hints for aspiring writers?

    I’m planning to start my own site 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 overwhelmed ..
    Any suggestions? Cheers!

  10. Do you mind if I quote a few of your articles as long as I provide credit and sources back
    to your weblog? My website is in the exact same area of interest as yours and my visitors would really benefit from a lot of the information you provide here.
    Please let me know if this alright with you. Many thanks!

  11. obviously like your web site but you need to check the spelling on quite a
    few of your posts. Many of them are rife with spelling problems and
    I to find it very troublesome to inform the reality however I
    will definitely come back again.

  12. I’m amazed, I must say. Rarely do I come across a blog that’s both equally
    educative and entertaining, and let me tell you,
    you have hit the nail on the head. The issue is something
    too few men and women are speaking intelligently about.
    Now i’m very happy that I stumbled across this in my search for something regarding this.

  13. Good day! Would you mind if I share your blog with my facebook group?

    There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Cheers

  14. Hi, I think your site might be having browser compatibility issues.
    When I look at your blog site in Opera, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you
    a quick heads up! Other then that, very good
    blog!

  15. I just could not go away your website before suggesting that I
    extremely enjoyed the standard info an individual supply for your visitors?
    Is going to be again frequently to investigate cross-check new posts

  16. Wow, superb weblog structure! How long have you been running a blog for?
    you make running a blog look easy. The whole glance of your site is
    magnificent, as smartly as the content material!

  17. Hello my friend! I wish to say that this article is awesome, nice written and come
    with almost all vital infos. I would like to see extra posts like this .

  18. Greetings! Quick question that’s completely off topic.
    Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone 4. I’m trying to find a theme or plugin that might be able to resolve this problem.

    If you have any suggestions, please share. Thanks!

  19. I simply couldn’t go away your site prior to suggesting that I extremely enjoyed the usual information a person supply for your visitors?

    Is going to be back frequently in order to check up on new
    posts

  20. You’re so interesting! I do not suppose I’ve truly read something like this before.
    So great to discover somebody with genuine thoughts on this subject matter.
    Really.. thanks for starting this up. This web site is one
    thing that is required on the web, someone with some originality!

  21. First of all I want to say excellent blog! I had a quick question in which
    I’d like to ask if you do not mind. I was curious to know how you center yourself and clear your
    thoughts before writing. I have had trouble clearing my
    mind in getting my thoughts out. I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes tend to be wasted simply just trying to figure out how to begin.
    Any ideas or tips? Thank you!

  22. Link exchange is nothing else but it is simply placing the other person’s blog link on your page at proper place
    and other person will also do similar in support
    of you.

  23. Howdy! I realize this is sort of off-topic however I needed to ask.
    Does running a well-established website such as yours require a lot of work?
    I am brand new to writing a blog however I do write in my diary
    every day. I’d like to start a blog so I can share my
    own experience and thoughts online. Please let me know if you have any
    kind of recommendations or tips for brand new aspiring blog owners.
    Appreciate it!

  24. Do you have a spam problem on this site; I also am a blogger, and I
    was curious about your situation; many of us have developed some nice methods and we are
    looking to exchange solutions with other folks, please shoot me an e-mail
    if interested.

Comments are closed.