python
u010969626
这个作者很懒,什么都没留下…
展开
-
python学习
import mathdef main(): print ("this program find the real solution to a quadratic") a, b, c=eval(input("please input the coefficients(a,b,c):")) delta=b*b-4*a*c if delta>=0:原创 2017-05-01 19:03:22 · 235 阅读 · 0 评论 -
二次方程求解
import mathdef main(): print ("let us find the solution to a quadratic\n") a, b, c=eval(input("please input the coefficients(a,b,c):")) delta=b*b-4*a*c if a==0: x=-b/c原创 2017-05-01 19:17:39 · 323 阅读 · 0 评论 -
python随机模块
import randomx=random.randint(1,6)y=random.choice(["apple","banana","cherry","durian"])print(x,y)原创 2017-05-03 13:51:41 · 349 阅读 · 0 评论 -
python异常处理
s=input("enter an integer:")try: i=int(s) print("valid integer entered:",i)except ValueError as err: print(err)while True: try: x=int(input("Please enter a number:"))原创 2017-05-03 14:49:01 · 639 阅读 · 0 评论