Esempio n. 1
0
def my_weight_third():
    print ('请输入你的体重:',end='')
    weight=input()
    while not input_type.is_float(weight):
        print ('请正确输入体重:',end='')
        weight=input()
    weight=float(weight)
    print ('请输入你的体重年增量:',end='')
    up=input()
    while not input_type.is_float(up):
        print ('请正确输入体重年增量:',end='')
        up=input()
    up=float(up)
    print ('请输入统计年数:',end='')
    year=input()
    while not input_type.is_int(year):
        print ('请正确输入统计年数:',end='')
        year=input()
    year=int(year)
    moon_list=[]
    earth_list=[]
    i=0
    while i<year:
        moon_weight=weight*0.165
        earth_list.append(weight)
        moon_list.append(moon_weight)
        i=i+1
        weight=weight+up
    i=0
    while i<year:
        print ('第%d年,在地球体重:%.2f kg,在月球体重:%.2f kg' % (i+1 , earth_list[i] , moon_list[i]))
        i=i+1
Esempio n. 2
0
office_use=['桌子','椅子','电脑','文件夹','纸笔']
office=_6_1.My_office(office_use)
#office.print_office_use()
print ('月球上你的体重是在地球上的16.5%,假设你每年增长1公斤,打印未来15年你的体重状况。')
weight=_6_1.My_weight(50)
#weight.print_weight()
print ('用函数计算任务四第三个问题中的你的体重(参数为当前体重和体重的年增量)')
weight_first=_6_1.My_weight_first(50,2)
#weight_first.print_weight()
print ('用函数计算任务四第三个问题中的你的体重(参数为当前体重、体重的年增量和统计的年数)')
weight_second=_6_1.My_weight_second(60,2,10)
#weight_second.print_weight()
print ('用函数计算任务四第三个问题中的你的体重,当前体重、体重的年增量和统计年数都由输入给出。')
print ('请输入你的体重:',end='')
weightnext=input()
while not input_type.is_float(weightnext):
    print ('请正确输入体重:',end='')
    weightnext=input()
weightnext=float(weightnext)
print ('请输入你的体重年增量:',end='')
up=input()
while not input_type.is_float(up):
    print ('请正确输入体重年增量:',end='')
    up=input()
up=float(up)
print ('请输入统计年数:',end='')
year=input()
while not input_type.is_int(year):
    print ('请正确输入统计年数:',end='')
    year=input()
year=int(year)