fork download
  1. #Posts the depth of a switcharoo
  2. def switcharoo(comment, body):
  3. lowercaseComment = body.lower()
  4. if "switcharoo" in lowercaseComment:
  5. depth = getSwitcharooDepth(body)
  6. return ("This switcharoo has a depth of " + depth + ". Godspeed." , comment)
  7. else:
  8. return None
  9.  
  10.  
  11.  
  12. #Returns the link to the next switcharoo
  13. def getSwitcharooLink(body):
  14. if #post has a link to a reddit comment in it, :
  15. return #The link
  16. else :
  17. return null
  18.  
  19. #Returns the depth of a switcharoo given the body of the comment using evil recursion magic
  20. def getSwitcharooDepth(body):
  21. link = getSwitcharooLink(body)
  22. if link is null:
  23. #sometimes dumb people don't link directly to the switcharoo though
  24. #however, usually they'll link to the parent or the child of it.
  25. #maybe if I become less lazy, I'll check the parent as well and all of the
  26. #children for a link.
  27. return 0
  28. else:
  29. return 1 + getSwitcharooDepth(#the comment body of the link)
Runtime error #stdin #stdout #stderr 0s 7724KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
  File "prog.py", line 14
    if #post has a link to a reddit comment in it, :
                                                   ^
SyntaxError: invalid syntax