習題1-1 平均數
from decimal import *
a = input()
b = input()
c = input()
a = int(a)
b = int(b)
c = int(c)
getcontext().prec = 3
print(Decimal(a+b+c) / Decimal(3))
習題1-2 溫度
from decimal import *
f = input()
f = int(f)
getcontext().prec = 5
print(Decimal(5*(f-32))/Decimal(9))
習題1-3 連續和
n = input()
n = int(n)
sum = 0
for i in range(1, n+1):
sum += i
print(sum)
習題1-4 正弦和餘弦
import math
n = int(input())
print(math.sin(n))
print(math.cos(n))
習題1-5 打折
count = int(input())
if count * 95 < 300:
print('%.2f' % float(count * 95))
elif count * 95 >= 300:
print('%.2f' % float(count * 95 * 0.85))
習題1-6 三角形
a = int(input())
b = int(input())
c = int(input())
if a + b > c and a + c > b and b + c > a:
print('yes')
else:
print('no')
習題1-7 年份
year = int(input())
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
print('yes')
else:
print('no')