import math
def quadratic_equation(a, b, c):
m=b*b-4*a*c
if m<0:
print('data error')
return
else:
n=math.sqrt(m)
x1=(-b+n)/(2*a)
x2=(-b-n)/(2*a)
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
def quadratic_equation(a, b, c):
m=b*b-4*a*c
if m<0:
print('data error')
return
else:
n=math.sqrt(m)
x1=(-b+n)/(2*a)
x2=(-b-n)/(2*a)
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
2020-02-01
最新回答 / 慕斯2029879
L = ['Adam', 'Lisa', 'Bart', 'Paul']是list数据类型,for name in L可以直接便利L这个list的每一个元素,遍历完就停止循环,并且每次循环就把当前元素赋值给name变量
2020-02-01
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
2020-01-31