for x in [1,2,3,4,5,6,7,8,9]:
for y in [0,1,2,3,4,5,6,7,8,9]:
if x < y:
print (x * 10 + y), '(', (x), '<', (y), ')'
for y in [0,1,2,3,4,5,6,7,8,9]:
if x < y:
print (x * 10 + y), '(', (x), '<', (y), ')'
2018-11-13
i=[]
for i in range (1, 101):
if i%7==0:
print i
后面看到有人用了切片,觉得从你人还是很多的。
for i in range (1, 101):
if i%7==0:
print i
后面看到有人用了切片,觉得从你人还是很多的。
sum = 0
x = 1
while x < 100:
if x % 2 != 0:
sum += x
x = x + 1
print sum
x = 1
while x < 100:
if x % 2 != 0:
sum += x
x = x + 1
print sum
2018-11-12
def fistcahupper(s):
return s[:1].upper() +s[1:]
print fistcahupper('hellow')
return s[:1].upper() +s[1:]
print fistcahupper('hellow')
2018-11-11
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
2018-11-10
还可以这样
for x in range(1,10):
for y in range(0,10):
if x < y:
print x*10 + y
for x in range(1,10):
for y in range(0,10):
if x < y:
print x*10 + y
2018-11-10
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for x in L:
if x in s:
s.remove(x)
else:
s.add(x)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for x in L:
if x in s:
s.remove(x)
else:
s.add(x)
print s
2018-11-08