Friday 27 September 2019

ASK T3 : BAB 4 : PELBAGAI CONTOH PROCEDURE LIRIK "SEJAHTERA MALAYSIA", "SING A SONG OF SIXPENCE"

Contoh aturcara 1:







Output:





Contoh 2:







Output:



Copy dan paste kod aturcara ini ke dalam IDLE Python untuk belajar tentang Procedure:

#LAGU SING A SONG OF SIXPENCE
def start():
    print("Sing a song of sixpence,")
    print("A pocket full of rye,")
    print("Four and twenty blackbirds")
    print("Baked in a pie.")
    print()

def pie():
    print("When the pie was opened")
    print("The birds began to sing—")
    print("Wasn't that a dainty dish")
    print("To set before the king?")
    print()

#Aturcara Utama
print("NURSERY RHYME : SING A SONG OF SIXPENCE")
print("Songwriters: Chris Harriott\n")
print("3 KRK!! Jom nyanyi sama-sama\n\n")

start()
pie()

print("The king was in the counting-house")
print("Counting out his money,")
print("The queen was in the parlor")
print("Eating bread and honey,")
print()

print("The maid was in the garden")
print("Hanging out the clothes.")
print("Along came a blackbird")
print("And snipped off her nose.")
print()

start()
pie()


#LAGU HAPPY BIRTHDAY
def lagu(nama):
    print("Happy Birthday to you!")
    print("Happy Birthday to you!")
    print("Happy Birthday, dear " + nama + ".")
    print("Happy Birthday to you!")

def nyanyi():
    pengguna = input("Masukkan nama pengguna : ")
    lagu(pengguna)

nyanyi()

0 comments:

Post a Comment

Featured post

Handwritten note... ASK T1 HTML

 

 

SAINS KOMPUTER & ASAS SAINS KOMPUTER Template by Ipietoon Cute Blog Design