0

could somebody explain this longer way? I don't really understand that part of code, how it works. Could somebody write it out long way like: if thing = "x" if thing = ...

thing = "x" if thing.lower() == "o" else "o"
c0ffi
  • 1
  • 5
  • `thing` is assigned `"x"` if `thing.lower()` is `"o"` (i.e. that segment of the line evaluates to `True`), otherwise it's assigned `"o"`. – blacksite May 22 '17 at 19:16

1 Answers1

2

It is equivalent to

if thing.lower() == "o":
    thing = "x"
else:
    thing = "o"
fuglede
  • 17,388
  • 2
  • 54
  • 99