Program Pattern Using 'While' in Python

Hello world!
In this post, I'll write how to make a simple pattern using Python.

Yaaap. Here we go! X)

angka1 = 5
string = ""

while angka1 > 0: 
  angka2 = angka1
  
  while angka2 > 0:
    string = string + "*"
    angka2 = angka2 - 1
    
  string = string + "\n"
  angka1 = angka1 - 1 
  
print string
PS: I am using an online compiler, Ideone
Now, lemme give you my screenshot, so you can see like what I'm typing this code.

And....THIS IS IT!

Horay! We did it! \(^o^)/
And yes! you can modification this code to be something new different.
Thank you! XOXO



Comments

Post a Comment

Popular posts from this blog