d = {
'Adam': 95, 'Lisa': 85, 'Bart': 59,}
a={'Paul':75}
d.update(a)
print d
'Adam': 95, 'Lisa': 85, 'Bart': 59,}
a={'Paul':75}
d.update(a)
print d
2020-03-19
sum = 0
x = 1
n = 1
while True:
sum+=x
x=2**(n)
n+=1
if n >20:
break
print sum
x = 1
n = 1
while True:
sum+=x
x=2**(n)
n+=1
if n >20:
break
print sum
2020-03-19
sum = 0
x = 1
n = 1
while True:
x=2**(n-1)
n+=1
if n >21:
break
sum+=x
print sum
x = 1
n = 1
while True:
x=2**(n-1)
n+=1
if n >21:
break
sum+=x
print sum
2020-03-19
s =('Python was started in 1989 by "Guido".'"\n""Python is free and easy to learn.")
print s
print s
2020-03-19
for x in range(1,9):
for y in range(10):
if x<y:
print(x*10+y)
for y in range(10):
if x<y:
print(x*10+y)
2020-03-19
print [int(x+y+v) for x in '123456789' for y in '0123456789' for v in '123456789' if x==v]
2020-03-18
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for key, value in d.iteritems():
sum = sum + value
print key, ':', value
print 'average', ':', sum/len(d)
sum = 0.0
for key, value in d.iteritems():
sum = sum + value
print key, ':', value
print 'average', ':', sum/len(d)
2020-03-18
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for i in d.itervalues():
sum=sum+i
print sum/len(d)
sum = 0.0
for i in d.itervalues():
sum=sum+i
print sum/len(d)
2020-03-18