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,249 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Hi there this is somewhat of off topic but I was wondering 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 greatly appreciated!

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

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

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

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

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

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

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

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

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

  11. Wow, marvelous blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your web site is wonderful, let alone the content!

  12. Its such as you read my mind! You appear to grasp so much about this, such as
    you wrote the ebook in it or something. I think that
    you could do with some % to drive the message home a bit, but other than that,
    this is great blog. A great read. I’ll definitely be back.

  13. I have fun with, result in I discovered just what I used
    to be having a look for. You’ve ended my four day lengthy hunt!
    God Bless you man. Have a nice day. Bye

  14. Hello! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for
    some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Cheers!

  15. you are in reality a just right webmaster. The web site loading speed is amazing.
    It kind of feels that you’re doing any distinctive trick.

    Moreover, The contents are masterpiece. you have performed a excellent activity on this matter!

  16. I’ve been surfing on-line more than 3 hours as of late, but I never found any interesting article like yours.
    It is pretty price enough for me. In my view, if all
    webmasters and bloggers made good content as you did, the web can be much more useful than ever before.

  17. Good day! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done a outstanding job!

  18. Today, I went to the beach with my children. I found a sea shell
    and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear
    and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is totally off
    topic but I had to tell someone!

  19. Appreciating the time and energy you put into your blog and in depth information you offer.
    It’s great to come across a blog every once in a while that isn’t the same unwanted rehashed information.
    Excellent read! I’ve saved your site and I’m adding
    your RSS feeds to my Google account.

  20. Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I am going to come back once again since I saved as a favorite it.
    Money and freedom is the best way to change, may you be rich and continue to help other people.

Comments are closed.