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. Have you eveг thoսght about writing an е-book ߋr guest authoring ᧐n оther blogs?
    I have a blog centered ߋn tһе same subjects you discuss and wоuld rеally
    like to hɑve yoᥙ share some stories/infоrmation. I know mmy viewers ԝould
    аppreciate youг work. If you’re even remotely іnterested,
    feel free to shoot mе аn email.

    my wegpage – leia mais informações

  2. What’s up everyone, it’s my first pay a visit at this web site, and paragraph is in fact fruitful in support of me, keep up posting these content.

  3. Hi there i am kavin, its my first occasion to commenting anyplace, when i read this piece
    of writing i thought i could also make comment due to this brilliant piece
    of writing.

  4. Right now it appears like Drupal is the preferred blogging platform available right now.

    (from what I’ve read) Is that what you’re using on your blog?

  5. Hey are using WordPress for your site platform?
    I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  6. I was wondering if you ever thought of changing the 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 2 pictures. Maybe you could space it out better?

  7. Attractive component of content. I just stumbled upon your blog and in accession capital to claim
    that I get in fact loved account your blog posts.
    Anyway I will be subscribing to your feeds or even I fulfillment you get right of entry to constantly rapidly.

  8. Wow, amazing blog format! How lengthy have you been running
    a blog for? you made running a blog look easy. The overall glance
    of your site is magnificent, let alone the content material!

  9. Having read this I believed it was rather informative. I appreciate you finding the time and energy to put this
    content together. I once again find myself personally
    spending a lot of time both reading and posting comments.
    But so what, it was still worth it!

  10. Asking questions are truly pleasant thing if you are not understanding something entirely, but
    this paragraph gives good understanding yet.

  11. Ahaa, its good dialogue on the topic of this article here
    at this weblog, I have read all that, so now me also commenting at this place.

  12. Pretty component of content. I simply stumbled upon your blog
    and in accession capital to say that I acquire in fact loved account your blog posts.
    Any way I will be subscribing for your augment or even I fulfillment you access consistently rapidly.

  13. Appreciating the persistence you put into your site and in depth information you
    provide. It’s good to come across a blog every once in a while that isn’t the same outdated rehashed information.
    Wonderful read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

  14. I was wondering 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 one or two pictures.
    Maybe you could space it out better?

  15. If some one desires expert view regarding blogging and site-building then i recommend
    him/her to pay a quick visit this web site, Keep up
    the nice job.

  16. Hi would you mind letting me know which webhost you’re using?
    I’ve loaded your blog in 3 completely different
    browsers and I must say this blog loads a lot faster then most.
    Can you suggest a good internet hosting provider
    at a honest price? Kudos, I appreciate it!

  17. you are actually a excellent webmaster. The site loading pace is incredible.

    It seems that you’re doing any distinctive trick. In addition, The contents are masterpiece.
    you’ve performed a wonderful task in this subject!

  18. Good day! Do you know if they make any plugins to protect against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  19. Every weekend i used to pay a quick visit this web site, because i want enjoyment, as
    this this site conations actually pleasant funny stuff too.

Comments are closed.