The Question (from http://bit.ly/KxmVcS) :
The Code :
# 4 line version
for i in range(0,10,1):
print (i*'#') + (22 - i*2) * ' ' + (i*'#')
for i in range(10,0,-1):
print (i*'#') + (22 - i*2) * ' ' + (i*'#')
OR
# 5 line version
def hourglass(a,b,c):
for i in range (a,b,c):
print (i*'#') + (22 - i*2) * ' ' + (i*'#')
hourglass(0,10,1)
hourglass(10,0,-1)
Reflection : Managed to figure out how the pattern of the code should be after 10 minutes of screwing around with the codes.
I'm bad with visualizing such stuffs in my mind with program codes, hope next time don't have such troublesome question lol.
Thursday, June 14, 2012
Thursday, 14th June 2012
Today programming lesson
Tio scam
Not ball, but is a moving stick
Teacher tell me is a running man, what shitty graphics is that lol
Gao~
Managed to finish today de programming target cause got help from other programmers
Hate visualizing weird things =.=
Reflection Journal also need write about codes LOL
After programming lesson, went for 2nd UT
Which is Communication Practice
Kinda easy actually, at least easier than Creative Concepts lol
At least no need think about durian and batman~
Tio scam
Not ball, but is a moving stick
Teacher tell me is a running man, what shitty graphics is that lol
Gao~
Managed to finish today de programming target cause got help from other programmers
Hate visualizing weird things =.=
Reflection Journal also need write about codes LOL
After programming lesson, went for 2nd UT
Which is Communication Practice
Kinda easy actually, at least easier than Creative Concepts lol
At least no need think about durian and batman~
Subscribe to:
Posts (Atom)