2021-08-26: SyntaxError: unexpected EOF while parsing

SyntaxError: unexpected EOF while parsing

1.源代码与错误

'''
5.编程求解1-4这4个数字可以组成多少个无重复的三位数,按从小到大的顺序输出这些数字。
analyze:
    判断条件是 无重复是出口,三个数都可以产生1234,分为三层吗?还是分为个十百。
'''
count = 0
for i in range(1,5):
    for j in range(1,5):
        for k in range(1,5):
            if i != j & j != k & k != i:
                s = 100*i+10*j+k
                count += 1
                print('number is {},count is {:.0d}.'.format(s, count)

错误如下:

runfile('C:/Users/caotong/.spyder-py3/ctt_python_study_aboutData/Unit2-test_5About1234.py', wdir='C:/Users/caotong/.spyder-py3/ctt_python_study_aboutData')
  File "C:\Users\caotong\.spyder-py3\ctt_python_study_aboutData\Unit2-test_5About1234.py", line 20
    print('number is {},count is {:.0d}.'.format(s, count)
                                                          ^
SyntaxError: unexpected EOF while parsing

在下,蠢笨分析一下:

SyntaxError 翻译 :语法错误
EOF 翻译:End of File
parsing 翻译:解释器

解释器在文件结束都没找到他所期待的东西。
format 格式化函数函数出现了语法问题,更正如下:

老天爷,最后发先是最后差了了括号!
print(‘number is {} ; count is {}.’.format(s, count))

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青灯画琉璃

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值