详细步骤如下 设一个值作为容器 num = 1 #不能为0,因为0乘任何数都为0 设置变量n num = 1 n = int(input('n=')) 当n为0时,直接提示0!=1 num = 1 n = int(input('n=')) if n == 0: print