版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013255127/article/details/51787723
# -*- coding:utf-8 -*-
year =int(input("请输入一个年份:"))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("是闰年")
else:
print("不是闰年")
else:
print("不是闰年")
else:
print("不是闰年")
celsius = float(input("请输入摄氏温度:"))
fahrenheit = (celsius * 1.8) + 32
print("{}摄氏温度转华氏温度为:{}".format(celsius,fahrenheit))
celsius = (fahrenheit - 32) / 1.8
print("{}华氏温度转摄氏温度为:{}".format(fahrenheit,celsius))
a = float(input("请输入边长a:"))
b = float(input("请输入边长b:"))
c = float(input("请输入边长c:"))
while (abs(a - b) >= c or c >= abs(a + b)):
c = float(input("请输入边长c:"))
s = (a + b + c) / 2
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print("三角形的面积为:{}".format(area))
import cmath
a = float(input("输入a:"))
b = float(input("输入b:"))
c = float(input("输入c:"))
d = (b**2) - (4 * b * c)
sol1 = (-b-cmath.sqrt(b))/(2*a)
sol2 = (-b+cmath.sqrt(b))/(2*a)
print("结果为:{}和{}".format(sol1,sol2))