student—化简比

s=float(input('前项:'))
d=float(input('后项:'))
a=1
f=[]
while a<=s and a<=d:
    if s%a==0 and d%a==0:
        f.append(a)
        a=a+1   
    else:
        a=a+1
g=max(f)
print(f'{s//g}比{d//g}')
  • 陈方旭

    Related Posts

    for循环

    一、for循环的核心语法 for循环是Python中用于遍历…

    分支结构(if)

    在 Python 中,if 语句是实现条件判断的核心工具,不…

    发表回复

    您的邮箱地址不会被公开。 必填项已用 * 标注