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.

16,631 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. I was curious if you ever considered changing the 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 2 images. Maybe you could space it out
    better?

  2. Greetings from Carolina! I’m bored to tears at work so I decided to check out your blog on my iphone during lunch break.

    I love the info you provide here and can’t wait to take
    a look when I get home. I’m amazed at how fast your blog loaded on my
    mobile .. I’m not even using WIFI, just 3G ..

    Anyways, very good blog!

  3. An interesting discussion is definitely worth comment.
    I believe that you should write more on this issue, it may not be
    a taboo subject but generally people don’t discuss these topics.
    To the next! All the best!!

  4. Hello! I just wanted to ask if you ever have any issues
    with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no data backup.

    Do you have any methods to prevent hackers?

  5. Excellent way of explaining, and fastidious piece of writing to get information on the topic of my presentation subject matter, which i am going to
    convey in college.

  6. Yesterday, while I was at work, my sister stole my
    iPad and tested to see if it can survive a 30 foot drop,
    just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is completely off topic but I
    had to share it with someone!

  7. You could definitely see your skills in the article you write.
    The sector hopes for more passionate writers such as you who aren’t afraid to mention how they believe.
    All the time go after your heart.

  8. Hi, this weekend is pleasant in favor of me, for the reason that this moment i am reading this enormous informative post
    here at my house.

  9. Its like you read my mind! You appear to know a
    lot about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive the
    message home a bit, but instead of that, this is excellent blog.

    A great read. I’ll certainly be back.

  10. Have you ever considered about including a little bit more than just your articles?

    I mean, what you say is important and all.
    Nevertheless think of if you added some great pictures or videos to give your posts more,
    “pop”! Your content is excellent but with pics and videos, this blog could
    definitely be one of the greatest in its
    field. Great blog!

  11. We are a group of volunteers and opening a brand new scheme
    in our community. Your site provided us with helpful
    information to work on. You have done a formidable job and
    our entire community can be grateful to you.

  12. Hello, i read your blog from time to time and i own a similar
    one and i was just curious if you get a lot of spam remarks?
    If so how do you prevent it, any plugin or anything you can advise?

    I get so much lately it’s driving me mad so any help is very much appreciated.

  13. Hi, I do believe this is an excellent site. I stumbledupon it
    😉 I may revisit once again since I bookmarked it.

    Money and freedom is the greatest way to change, may you be rich and continue
    to guide other people.

  14. Today, I went to the beachfront with my kids. 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 placed 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!

  15. you are in point of fact a good webmaster. The web site loading pace is amazing.
    It seems that you are doing any distinctive trick. In addition, The contents are masterpiece.
    you’ve performed a fantastic task in this matter!

  16. You ought to be a part of a contest for one of the best blogs on the net.
    I most certainly will recommend this site!

  17. Pretty section of content. I just stumbled upon your site and in accession capital to assert that I acquire in fact enjoyed account your
    blog posts. Anyway I will be subscribing to your augment and
    even I achievement you access consistently rapidly.

  18. Good blog you have got here.. It’s difficult to find excellent writing like yours these days.
    I truly appreciate people like you! Take care!!

  19. Hi! Quick question that’s entirely off topic. Do you know how
    to make your site mobile friendly? My blog looks weird when viewing from
    my apple iphone. I’m trying to find a theme or plugin that might be able to correct
    this issue. If you have any suggestions, please share.
    Appreciate it!

  20. Pretty great post. I simply stumbled upon your
    blog and wanted to say that I’ve truly enjoyed browsing your weblog posts.
    In any case I will be subscribing to your feed and I hope you
    write again soon!

  21. Hi there i am kavin, its my first occasion to commenting anywhere,
    when i read this paragraph i thought i could also make comment due
    to this sensible piece of writing.

  22. all the time i used to read smaller posts that also clear their motive, and
    that is also happening with this paragraph which I am reading at this place.

  23. of course like your web-site but you need to check the spelling on quite a few of your posts.
    A number of them are rife with spelling issues and I in finding
    it very bothersome to tell the reality nevertheless I will surely come again again.

  24. I’m amazed, I have to admit. Seldom do I come across a
    blog that’s both educative and amusing, and let me tell
    you, you’ve hit the nail on the head. The problem is something that not enough men and women are speaking
    intelligently about. I’m very happy I stumbled across this
    in my hunt for something relating to this.

Comments are closed.