第25721题 单选题
判断给定Python幸运数/超级幸运数判断代码的说法正确的是()

在下面的Python代码中,N必须是小于10大于1的整数,M为正整数(大于0)。如果M整除N则为幸运数,如果M中含有N且能整除,则为超级幸运数,否则不是幸运数。程序用于判断M是否为幸运数或超级幸运数或非幸运数。

N = int(input("请输入幸运数字:"))
M = int(input("请输入正整数:"))
if M % N == 0:
    Lucky = True
else:
    Lucky = False
while M != 0:
    if M % 10 == N and Lucky == True:
        print(f"{M}是{N}的超级幸运数")
        break
    M //= 10
else:
    if Lucky == True:
        print(f"{M}是{N}的幸运数")
    else:
        print(f"{M}非{N}的幸运数")
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析