zzy
3-python作业整活(代码分享)

3-python作业整活(代码分享)


        

这次作业整不出活了,直接放代码.

文件下载

提交作业

  1. 正常作业

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    #-- codeing=utf-8 --
    #@File:example2_3_1.py

    number = input("请输入股票代码:")
    name = input("请输入股票名称:")
    highest = float(input("请输入当天最高价:"))
    lower = float(input("请#-- codeing=utf-8 --
    #@File:example2_4.py

    import math

    a = float(input("请输入复数的实部:"))
    b = float(input("请输入复数的虚部:"))
    r = math.sqrt(a ** 2 + b ** 2)

    print('输入的复数为:',a,'+',b,'j',sep='')
    print('复数的模为:',r,sep='')输入当天最低价:"))
    diff = highest - lower
    print("股票代码:", number, "股票名称:", name)
    print("最高价:", highest, "最低价:", lower, "差值:", diff, sep="")

    #-- codeing=utf-8 --
    #@File:example2_3_2.py

    number = input('请输入股票代码:')
    name = input('请输入股票名称:')
    highest = float(input('请输入当天最高价:'))
    lower = float(input('请输入当天最低价:'))
    diff = highest - lower
    print("股票代码+股票名称:" + number + "+" + name)
    print("最高价:", highest, "最低价:", lower, "差值:", diff, sep="")

    #-- codeing=utf-8 --
    #@File:example2_4.py

    import math

    a = float(input("请输入复数的实部:"))
    b = float(input("请输入复数的虚部:"))
    r = math.sqrt(a ** 2 + b ** 2)

    print('输入的复数为:',a,'+',b,'j',sep='')
    print('复数的模为:',r,sep='')

    #-- codeing=utf-8 --
    #@File:exercise3_1.py

    F = input('请输入华氏度')
    C = (F-32)*5/9
    print('对应摄氏度为:',C,sep='')

    #-- codeing=utf-8 --
    #@File:exercise3_2.py

    s1 ,s2 ,s3= input('请输入第一位学生成绩') ,input('请输入第二位学生成绩') ,input('请输入第三位学生成绩')
    avg = (s1 + s2 + s3)/3
    print(avg)

    keys = {
    1:'F',
    2:'F',
    3:'F',
    4:'F',
    5:'F',
    6:'T',
    7:'T',
    8:'F',
    }
  2. 我的:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    #-- codeing=utf-8 --
    #@Time:2024-3-15
    #@Author:zzy
    #@File:exercise3.py
    #@Software:vscode

    # 2-3
    number = input("请输入股票代码:")
    name = input("请输入股票名称:")
    highest = float(input("请输入当天最高价:"))
    lower = float(input("请输入当天最低价:"))
    diff = highest - lower
    print(f'''股票代码:{number},股票名称:{name}
    最高价:{highest},最低价:{lower}, 差值:{diff}''')

    # 2-4
    import math
    r = float(input("请输入复数的实部:"))
    i = float(input("请输入复数的虚部:"))
    m = math.sqrt(r ** 2 + i ** 2)

    print(f'输入的复数为:{r}+{i}j\n复数的模为:{m}')

    # 课后练习
    # 1
    F = input('请输入华氏度')
    C = (F-32)*5/9
    print(f'对应摄氏度为:{C}')
    # 2
    s1 ,s2 ,s3= input('请输入第一位学生成绩') ,input('请输入第二位学生成绩') ,input('请输入第三位学生成绩')
    avg = (s1 + s2 + s3)/3
    print(avg)

    # 判断
    keys = {
    1:'F',
    2:'F',
    3:'F',
    4:'F',
    5:'F',
    6:'T',
    7:'T',
    8:'F',
    }
    for key in keys:
    print(f'第{key}题的答案是{keys[key]}')
本文作者:zzy
本文链接:http://周梓煜.com/2024/03/15/school-hhw-3-python/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可