【问题标题】:how do you solve this python coding? I want to say the output of text=2 is yes but the output says syntax error你如何解决这个python编码?我想说 text=2 的输出是 yes 但输出显示语法错误
【发布时间】:2022-09-27 11:43:17
【问题描述】:

如果我想说文本是否为 2,那么您如何编码,那么输出将为是? 这就是我编码的方式:

text=int(input())

if text<2:

    print(False)

if text>2:

    print(True)
if text=2:

    print(\'yes\')

但此输出显示 text=2 的语法错误。如何解决这个问题?

    标签: python


    【解决方案1】:

    尝试这个

    if text==2:
        print('yes')
    

    【讨论】:

      猜你喜欢
      • 2019-08-19
      • 2013-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多