print('hello,python');
print("hello,python");
print("hello,python");
2019-04-21
代码:已通过
print((0x12fd2) + 45678);
print("Learn Python in imooc");
print(100 < 99);
print(0xff == 255);
print((0x12fd2) + 45678);
print("Learn Python in imooc");
print(100 < 99);
print(0xff == 255);
2019-04-21
L = []
x=1
while x<=100:
L.append(x*x)
x=x+1
print sum(L)
这个题直接输出的是338350,可是按理来说,应该来说应该x从1到100的值都会输出出来吧
x=1
while x<=100:
L.append(x*x)
x=x+1
print sum(L)
这个题直接输出的是338350,可是按理来说,应该来说应该x从1到100的值都会输出出来吧
2019-04-21
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum1 = 0.0
for x in d.itervalues():
sum1+=x
print sum1/len(d.values())
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
print float(sum(d.values()))/len(d.values())
sum1 = 0.0
for x in d.itervalues():
sum1+=x
print sum1/len(d.values())
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
print float(sum(d.values()))/len(d.values())
2019-04-18
def average(*args):
if float(len(args)) == 0 :
return float(len(args))
return sum(args)/float(len(args))
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
if float(len(args)) == 0 :
return float(len(args))
return sum(args)/float(len(args))
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-04-18
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2019-04-18
print 'Python was started in 1989 by \"Guido\".'
print 'Python is free and easy to learn.'
print 'Python is free and easy to learn.'
2019-04-18
sum = 0
n = 1
a = 1
while n <= 100:
sum +=a
a=a+3
n=n+1
print(sum)
n = 1
a = 1
while n <= 100:
sum +=a
a=a+3
n=n+1
print(sum)
2019-04-18
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for k,v in d.items():
sum += v
print k,':',v
print 'average:',sum / len(d.items())
sum = 0.0
for k,v in d.items():
sum += v
print k,':',v
print 'average:',sum / len(d.items())
2019-04-18