def firstCharUpper(s):
a = s[0]
a = str(a.upper())
b = str(s[1:])
c = a + b
return c
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
a = s[0]
a = str(a.upper())
b = str(s[1:])
c = a + b
return c
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2016-12-19
L = []
n = 1
N = 0
i = 0
while True:
if N >= 100:
break
else:
L.insert(N,n)
n = n+1
N = N+1
for x in L:
xs = x*x
L[i] = xs
i = i+1
print L
Ls = sum(L)
print L,Ls
贴个最原始代码
n = 1
N = 0
i = 0
while True:
if N >= 100:
break
else:
L.insert(N,n)
n = n+1
N = N+1
for x in L:
xs = x*x
L[i] = xs
i = i+1
print L
Ls = sum(L)
print L,Ls
贴个最原始代码
2016-12-19
def move(n, a, b, c):
if n == 1:
print a,'-->',c
else :
move(n-1,a,c,b)
print a,'-->',c
move(n-1,b,a,c)
move(4, 'A', 'B', 'C')
if n == 1:
print a,'-->',c
else :
move(n-1,a,c,b)
print a,'-->',c
move(n-1,b,a,c)
move(4, 'A', 'B', 'C')
2016-12-19
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
2016-12-19
已采纳回答 / 静溪0
List=[] n=1 while True: List.append(n*n) n=n+1 if n>100: break print sum(List)
2016-12-19
L = ['Adam', 'Lisa', 'Bart']
L[0],L[2] = L[2],L[0]
print L
L[0],L[2] = L[2],L[0]
print L
2016-12-19