首页 > 解决方案 > 我们如何让程序输出一个int?

问题描述

我正在尝试制作一个有一个while循环的代码,里面是显示已经执行了多少句子的执行。为了向您展示我的意思,这是我的代码:

while riddle < 11:
    print('this is the '+riddle+ 'th execution')
    riddle = riddle+1

我的问题是,如果我运行它,我有这个错误:

Traceback (most recent call last):
  File "/home/thejackl/hello world/hello_world.py", line 62, in <module>

   print('this is the '+riddle+ 'th execution')

TypeError: must be str, not int

更多信息:

标签: python

解决方案


推荐阅读