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. I’m not sure why but this weblog is loading extremely slow for me.

    Is anyone else having this issue or is it a issue on my
    end? I’ll check back later on and see if the problem still exists.

  2. Hey there! This is my first visit to your blog!
    We are a group of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us useful information to work on. You have done a extraordinary job!

  3. What’s Happening i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has aided me out loads.
    I hope to give a contribution & assist other users like its aided me.
    Good job.

  4. Have you ever thought about adding a little bit more than just your
    articles? I mean, what you say is fundamental and all.
    However think of if you added some great images or videos to give your posts more, “pop”!
    Your content is excellent but with pics and clips, this blog could definitely be one
    of the very best in its niche. Wonderful blog!

  5. Piece of writing writing is also a fun, if you be familiar with afterward you can write otherwise
    it is complex to write.

  6. I think this is one of the so much significant info for me.
    And i’m happy reading your article. However want to remark on some common issues, The site taste is
    ideal, the articles is truly nice : D. Good job, cheers

  7. Hello there, There’s no doubt that your site
    may be having browser compatibility issues. Whenever I take a look at your blog in Safari, it
    looks fine however when opening in Internet Explorer, it’s got some overlapping
    issues. I just wanted to give you a quick heads up!
    Apart from that, wonderful site!

  8. Hi! Do you use Twitter? I’d like to follow you if that
    would be okay. I’m definitely enjoying your blog and look forward to new
    posts.

  9. I loved as much as you will receive carried out right
    here. The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an edginess over that you wish be delivering the following.
    unwell unquestionably come further formerly again as exactly
    the same nearly very often inside case you shield this
    hike.

  10. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or
    something. I think that you could do with a few pics to drive the message home a bit, but other than that, this
    is great blog. An excellent read. I will definitely be
    back.

  11. hi!,I like your writing so a lot! percentage we be in contact extra about your post on AOL?

    I require an expert on this house to resolve my problem. May be that’s you!

    Taking a look forward to look you.

  12. Hello there! Do you know if they make any plugins to help with SEO?
    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!

  13. I am curious to find out what blog system you are using?
    I’m experiencing some minor security problems with my latest blog
    and I’d like to find something more risk-free.
    Do you have any suggestions?

  14. Aw, this was an extremely nice post. Taking the time and actual effort to create a great article… but what can I say… I procrastinate
    a whole lot and never manage to get nearly anything done.

  15. Hi there, i read your blog occasionally and i
    own a similar one and i was just curious if you get a lot of spam remarks?
    If so how do you stop it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any help
    is very much appreciated.

  16. Hmm it appears like your blog ate my first comment (it was extremely long)
    so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.

    I as well am an aspiring blog blogger but I’m still new to the whole thing.
    Do you have any recommendations for novice blog writers?
    I’d certainly appreciate it.

  17. What i don’t realize is if truth be told how you’re now not actually
    a lot more neatly-appreciated than you might be now. You are so intelligent.
    You know therefore significantly in terms
    of this matter, made me in my opinion believe it from a lot of various angles.
    Its like men and women don’t seem to be fascinated unless it’s
    something to do with Woman gaga! Your own stuffs excellent.

    All the time maintain it up!

  18. A motivating discussion is definitely worth comment.
    There’s no doubt that that you ought to write more on this subject,
    it may not be a taboo matter but typically people don’t discuss
    these subjects. To the next! All the best!!

  19. I like the valuable information you provide in your articles.

    I’ll bookmark your weblog and check again here frequently.
    I’m quite certain I’ll learn plenty of new stuff right here!
    Best of luck for the next!

  20. Hey 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 experience so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  21. 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 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 entirely off topic but I had to tell someone!

  22. Its like you read my mind! You seem to know so much 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 little bit, but other than that, this is wonderful
    blog. A great read. I will certainly be back.

Comments are closed.