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

  1. It’s appropriate time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I want to suggest you some interesting things
    or advice. Perhaps you can write next articles referring to this article.
    I wish to read even more things about it!

  2. Fastidious answer back in return of this issue with genuine
    arguments and describing the whole thing on the topic of that.

  3. What i do not realize is in truth how you’re no
    longer really much more neatly-appreciated than you may
    be right now. You’re very intelligent. You realize therefore considerably in the case of
    this matter, made me for my part consider it from so many varied angles.

    Its like women and men don’t seem to be interested except it’s something to accomplish with Lady gaga!

    Your individual stuffs outstanding. At all times take care of it
    up!

  4. Way cool! Some very valid points! I appreciate you writing this article and also the rest of the
    site is also very good.

  5. Very nice post. I just stumbled upon your blog and wanted to say that I’ve truly enjoyed browsing your blog posts.
    After all I’ll be subscribing to your rss feed
    and I hope you write again very soon!

  6. Hats off to the delightfully creative local businesses that choose to call Minneapolis home. And what better time to support our wonderful retail community than the biggest shopping season of the year. Explore these stores… Our San Antonio rental specialists are adept at finding the perfect rental homes, condos and apartments for individuals and families. Our rental realtors in San Antonio can help you navigate lease agreements, tax questions, insurance and more. Use the Licensed Site, Licensed Content, or both for any purpose other than a personal, non-commercial one; Broker: ABSOLUTE Realty Group Inc. When you’re searching for the perfect rental, there are five questions to keep in mind: (1) Your ideal move-in date. (2) Your budget. (3) How many bedrooms do you need? (4) Which neighborhoods are you considering? (5) Do you have pets? We begin marketing rentals 60 days out. Keep checking back as your ideal move-in date draws closer to see what new listings have been added. https://franciscoztiw875319.blogpixi.com/11135327/city-hoa-management During this time we will continue to diligently promote our client’s properties and provide quality service to our buyer clients. We have much to be thankful for, including our valued clients, colleagues, friends, and family members. We understand the struggles of this time, but we have and will not waiver from our commitment to you. Feel free to reach out to us with any questions and we look forward to working through this and working with each of you. Save This Search and see the newest Ranches and Farms for sale in Boise, Idaho first. Δdocument.getElementById( “ak_js” ).setAttribute( “value”, ( new Date() ).getTime() ); UPDATE 03/09/2022: It must be frustrating to list a car for sale with No Reserve only to have the winning bidder fail to front with the cash. That has been the fate of the owner of this 1972 Chevrolet… moreВ»

Comments are closed.