码迷,mamicode.com
首页 > 其他好文 > 详细

课后练习

时间:2018-12-03 15:40:41      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:detail   作者   erro   来源   choice   lse   net   blog   原创   

1.

print("菜单".center(30,‘#‘))

a=(‘1.鲁班\n‘
‘2.程咬金\n‘
‘3.刘备‘)
print(a)
choice=int(input("请输入你的选项:"))

if choice==1:
print("鲁班")
elif choice==2:
print("程咬金")
else:
print("刘备")
2.

year=int(input("请输入年分:"))
mouth=int(input("请输入月分:"))

if mouth==2:
if year%4==0 and year%100!=0 or year%400==0:
print("29天")
else:
print("28天")
else:
if mouth==(1 or 3 or 5 or 7 or 8 or 10 or 12):
print("31天")
else:
print("30天")
3.

import math

a=float(input("input number:"))
b=float(input("input number:"))
c=float(input("input number:"))


delta=b**2-4*a*c
if delta>0:
x1=(-b+math.sqrt(b**2-4*a*c))/2*a
x2=(-b-math.sqrt(b**2-4*a*c))/2*a
print(x1x2)
elif delta==0:
x=-b/2*a
print(x)
else :
print("no answer")
4.

mouth=int(input("请输入月份:"))

if 3<=mouth<=5:
print("春季")
elif 6<=mouth<=8:
print("夏季")
elif 9<=mouth<=11:
print("秋季")
else:
print("冬季")
 

5.

a=input("请输入")

if a=="":
print("erro")
else:

---------------------
作者:qq_41911569
来源:CSDN
原文:https://blog.csdn.net/qq_41911569/article/details/81627934
版权声明:本文为博主原创文章,转载请附上博文链接!

课后练习

标签:detail   作者   erro   来源   choice   lse   net   blog   原创   

原文地址:https://www.cnblogs.com/jjdkd/p/10058085.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!