sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x % 2==1:
sum=sum+x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x % 2==1:
sum=sum+x
print sum
2016-01-25
L = []
x = 1
n = 0
while n < 100:
n = n + 1
x = n * n
L.append(x)
print sum(L)
x = 1
n = 0
while n < 100:
n = n + 1
x = n * n
L.append(x)
print sum(L)
2016-01-25
def greet(s='world'):
print 'hello,'+s.lower()+'.'
greet()
greet('Bart')
print 'hello,'+s.lower()+'.'
greet()
greet('Bart')
2016-01-25
def generate_tr(name, score):
if score > 60:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' %(name, score)
if score > 60:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' %(name, score)
2016-01-25