# 作业 1
# 1、闰年判断
year = int(input())
if year % 400 == 0 or (year % 4 == 0 and year % 100 !=0):
print(f'{year}是闰年')
else:
print(f'{year}不是是闰年')
# 2、韩信点兵
for i in range(1, 1500):
surplus_num = 1500 - i
if surplus_num % 3 == 2 and surplus_num % 5 == 4 and surplus_num % 7 == 6 and 1000 <= surplus_num <= 1100:
print(f'还剩下{surplus_num}人')
# 作业 2
# 1、最大公约数,最小公倍数
def odd(a, b):
mul = a * b
res = a % b
while res != 0:
a = b
b = res
res = a % b
print(int(b), int(mul / b),sep=', ')
a, b = map(int, input("输入两个数\n").split(','))
odd(a, b)
# 2、输出最大的数和最小的数及最大的数和最小的数的平均值
ls = []
try:
while True:
num = eval(input('请输入数字(直接输入回车退出):'))
ls.append(num)
except:
pass
for i in ls:
print(i, end=' ')
print()
print("最大的数:" + str(max(ls)), "最小的数:" + str(min(ls)), "最大的数和最小的数的平均值:" + str((max(ls) + min(ls))/2))
# 作业 3
# 1、小球
high = 100
fall_high = 100
all_high = 0
for i in range(10):
fall_high /= 2
if i != 9:
all_high += fall_high * 2
print(f'第十次落地总共经历{all_high + high}m')
print(f'第十次反弹高度为{fall_high}m')
# 2、在当前目录下创建一个文本文件test.txt,并向其中写入字符串hello world
with open('test.txt', 'w') as file:
file.write('hello world')