试图将一个布尔值设为True或False

Cha*_*and 0 python boolean

我的简单Python程序工作正常 - 它打印-1表示错误 - 但是如何让它在-1的位置打印单词False?

import sys
text= sys.argv[1]
red= "red"
# Write your code here

def isred():
  print(text.find(red))

isred()
Run Code Online (Sandbox Code Playgroud)

它打印-1但需要它打印"True"或"False".

Joh*_*ica 5

print(text.find(red) >= 0)
Run Code Online (Sandbox Code Playgroud)

或者,更简单:

print(red in text)
Run Code Online (Sandbox Code Playgroud)