Saturday, April 7, 2012

cara membuat jam pasir ? codingan

y="y"
while y == "y" :
    inp = int(raw_input("\nMasukkan tinggi : "))
    inp +=1
    print ""
    for i in range(0,inp-2,1) :
        for j in range(0,i,1) :
            print " ",

        for k in range(i+1,inp,1) :
            print "*",

        for l in range(inp,i+2,-1) :
            print "*",

        print ""

    for i in range(1,inp,1) :
        for l in range(inp-1,i,-1) :
            print " ",

        for k in range(1,i,1) :
            print "*",

        for j in range(0,i,1) :
            print "*",

        print ""

    print"\n"
    y=raw_input("Apakah anda ingin melanjut lagi (y/t) = ")

No comments:

Post a Comment