I Jones
I Jones

Reputation: 1

Rotate string HackerRank errors

Language: Python

Problem summary: I was at practice rotate string on HackerRank https://www.hackerrank.com/challenges/rotate-string/problem and I was coding there on the page and it was telling me that I had a lot of errors. One was Parse error in pattern: def. But this error and all other errors did not appear when I transferred the code to IDLE.

What I've tried: I then decided to transfer the code I had done to a python editor IDLE that I was using and then there were no errors and the code worked (almost as intended-I'm still working on it).

This is the same code that I did on the HackerRank page (I know it's not complete yet-I'm a beginner):

def printrotation(S):
    n = len(S)
    temp = S + S     
    for i in range(n):
        for j in range(n):
            print(temp[i + j], end = ' ')
        print()
S = 'cat'
printrotation(S)

Question: Why did I get so many errors for the same code that I placed in IDLE on the page at HackerRank?

Upvotes: 0

Views: 223

Answers (1)

MANJURUL HAQUE
MANJURUL HAQUE

Reputation: 144

First of all you may not be select any language in HackerRank page.

Your code is correct.

But for that problem you can not use python. Because HackerRank does not support python for that problem.

Upvotes: 1

Related Questions