Hello!
I’ve decided learning programming and started with python 2 days ago using the “Python for Everybody” course. I am currently in chapter 6 where he talks about strings and string methods. I have a question about using logic operators inside of a method call. When I use:
line = “Please”
x = line.startswith(“p” or “P”)
print(x)
the print statement returns false, although the line variable starts with a capital P. When i write it like this:
line = “Please”
x = line.startswith(“p”) or line.startswith(“P”)
print(x)
the print statement returns true. Can someone explain to me why I can’t use the “or” inside of the parameter brackets of the method and I have to write it separately?
Thanks in advance!
Kind regards