воскресенье, 12 июня 2011
кодprint "this programme counts the roots of an equation ax^2+bx+c=0"
import math
a=int(raw_input("Input a:"))
b=int(raw_input("Input b:"))
c=int(raw_input("Input c:"))
d=(b*b-4*a*c)
if d<0:
print "There's no roots"
elif d==0:
print "the only root is", ((-b)/(2*a))
else:
print "The first root is:", ((pow(d,0.5)-b)/(2*a))
print "The second root is:", ((-b-pow(d,0.5))/(2*a))
raw_input()осваиваем пайтон, да. первый код.