print 45678+0x12fd2
print'Learn Python in imooc'
print 100<99
False
print 0xff==255
True
print'Learn Python in imooc'
print 100<99
False
print 0xff==255
True
2020-02-11
sum = 0
x = 1
while x <= 100:
if not x % 2 == 0:
sum += x
x += 1
print sum
x = 1
while x <= 100:
if not x % 2 == 0:
sum += x
x += 1
print sum
2020-02-08
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:' ,d.get('Adam')
print 'Lisa:' ,d.get('Lisa')
print 'Bart:' ,d.get('Bart')
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:' ,d.get('Adam')
print 'Lisa:' ,d.get('Lisa')
print 'Bart:' ,d.get('Bart')
2020-02-07
sum = 0
x = 1
n = 1
while True:
x = x*2
sum = sum + x
n = n + 1
if n > 21:
break
print sum
x = 1
n = 1
while True:
x = x*2
sum = sum + x
n = n + 1
if n > 21:
break
print sum
2020-02-07
sum = 0
x = 1
while x < 100:
sum=sum+x
x=2*x+1
print sum
x = 1
while x < 100:
sum=sum+x
x=2*x+1
print sum
2020-02-07
L = range(0, 10)
print([x*100 + y*10 + z for x in L for y in L for z in L if x == z and x > 0])
print([x*100 + y*10 + z for x in L for y in L for z in L if x == z and x > 0])
2020-02-06
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
2020-02-06
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for k in d:
print k,':',d[k]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for k in d:
print k,':',d[k]
2020-02-06