【问题标题】:'<' not supported between instances of 'tuple' and 'int' [duplicate]'tuple'和'int'的实例之间不支持'<' [重复]
【发布时间】:2019-07-29 12:51:48
【问题描述】:

Python 宝贝卡在代码中。我知道这很幼稚,但你知道错误就是错误,我别无选择。

count=0,
    while(count<5):
        count=count+1
        count

【问题讨论】:

  • 你能展示更多你的代码吗?为什么count=0旁边有个逗号?
  • 0, 表示 count=(0,)count=0 完全不同。

标签: python while-loop


【解决方案1】:

首先,计数 0 旁边不需要逗号

其次,如果您需要打印计数,请使用 print(count) 而不是仅计数

【讨论】:

  • "首先,你~~不需要~~ 不能在计数0旁边放逗号"
  • 感谢大家。 @Ash Duffy Zac
猜你喜欢
  • 2020-11-15
  • 1970-01-01
  • 2022-12-15
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-10
  • 2020-05-19
相关资源
最近更新 更多