We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I passed all test cases on submiting or running the code for a few seconds and then it fails reverting with a Runtime Error:
Traceback (most recent call last):
File "/tmp/submission/20250121/02/01/hackerrank-fcae3a6b8a4ebd2191a0a3e1614f0f2d/code/Solution.py", line 11, in
s = input()
^^^^^^^
EOFError: EOF when reading a line
I tried catching the error but it still fails. Any Solutions?
This is the code:
def mutate_string(string, position, character):
return string[:position] + character + string[position + 1:]
if name == 'main':
try:
s = input().strip()
i, c = input().split()
s_new = mutate_string(s, int(i), c)
print(s_new)
except EOFError:
pass
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Mutations
You are viewing a single comment's thread. Return to all comments →
I passed all test cases on submiting or running the code for a few seconds and then it fails reverting with a Runtime Error: Traceback (most recent call last): File "/tmp/submission/20250121/02/01/hackerrank-fcae3a6b8a4ebd2191a0a3e1614f0f2d/code/Solution.py", line 11, in s = input() ^^^^^^^ EOFError: EOF when reading a line
I tried catching the error but it still fails. Any Solutions?
This is the code: def mutate_string(string, position, character): return string[:position] + character + string[position + 1:]
if name == 'main': try: s = input().strip() i, c = input().split() s_new = mutate_string(s, int(i), c) print(s_new) except EOFError: pass