for x in range(0,10):
for y in range(0,10):
for z in range(0,10):
if z == x:
print(str(x)+str(y)+str(z))
for y in range(0,10):
for z in range(0,10):
if z == x:
print(str(x)+str(y)+str(z))
2020-05-25
s = '''Python was started in 1989 by "Guido".
Python is free and easy to learn.'''
print (s)
Python is free and easy to learn.'''
print (s)
2020-05-23
L = [75, 92, 59, 68]
sum = 0.0
for score in L:
sum+=score
print sum / 4
sum = 0.0
for score in L:
sum+=score
print sum / 4
2020-05-23
L = ['Adam', 'Lisa', 'Bart']
L.pop(2)
L.pop(0)
L.insert(0,'Bart')
L.append('Adam')
print L
复习一下前面几节....
L.pop(2)
L.pop(0)
L.insert(0,'Bart')
L.append('Adam')
print L
复习一下前面几节....
2020-05-23
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for l1 in L:
if l1 in s:
s.remove(l1)
else :
s.add(l1)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for l1 in L:
if l1 in s:
s.remove(l1)
else :
s.add(l1)
print s
2020-05-22
# -*- coding: utf-8 -*-
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
x={}
for a, b in d.items():
a,b=b,a
x[a]=b
print(x)
for 循环写了个自动的
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
x={}
for a, b in d.items():
a,b=b,a
x[a]=b
print(x)
for 循环写了个自动的
2020-05-22
这种\(^_^)/ \(~_~)/我用''这个也没加r也可以打出来啊,很多需要转义的字符和加不加r没关系吧
2020-05-21
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(-1)
print L
L.pop(2)
L.pop(-1)
print L
2020-05-21
def square_of_sum(L):
return sum(i**2 for i in L)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
return sum(i**2 for i in L)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2020-05-18