我知道我应该可以自己解决这个问题,但是我该如何简单地编写一个根据输入改变某些值的代码。这是我的代码;
`
a = False
c = input("do you want A to be positive or negative?\n")
if c== "Pos" or "pos":
print("a switched to positive")
a = True
if c== "Neg" or "neg":
print("a switched to negative")
a = False
`虽然不行。我该怎么做?谢谢!
您的python语法错误。签入条件时,代替
if c == "Pos" or "pos"
您应该有,
if c == "Pos" or c == "pos"