def square_of_sum(L):
sum = 0
for x in L:
sum+=x*x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
sum = 0
for x in L:
sum+=x*x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2019-03-25
age = 20
if 18>age >= 6:
print 'teenager'
elif age >= 18:
print 'adult'
else:
print 'kid'
if 18>age >= 6:
print 'teenager'
elif age >= 18:
print 'adult'
else:
print 'kid'
2019-03-24
def quare_of_sum(L):
s = 0
for i in L:
j = i*i
s+=j
return s
print square_of_sum([1,2,3,4,5])
print square_of_sum([-5,0,5,15,25])
s = 0
for i in L:
j = i*i
s+=j
return s
print square_of_sum([1,2,3,4,5])
print square_of_sum([-5,0,5,15,25])
2019-03-23
for x in [ '1','2','3','4','5','6','7','8','9']:
for y in [ '1','2','3','4','5','6','7','8','9']:
if ord(x)<ord(y):
print(x+y)
for y in [ '1','2','3','4','5','6','7','8','9']:
if ord(x)<ord(y):
print(x+y)
2019-03-22
def firstCharUpper(s):
return s[:1].upper()+s[-(len(s)-1):]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[:1].upper()+s[-(len(s)-1):]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2019-03-21
x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = s = (x1+x100)*n/2
print s
d = 3
n = 100
x100 = x1+(n-1)*d
s = s = (x1+x100)*n/2
print s
2019-03-21