hackerrank python if else solution