Practicing Python (using Codewars)
I'm using Codewars as means of practicing what I've learned and how I apply it. However I encountered a challenge where I passed the test, but there's an error?
I don't see anywhere I can ask for help if I get stuck there. If I just copy and paste everything here should my code work for anyone to help me debug?
6 comments · 100% upvoted · other discussions
Objective: Remove n exclamation marks in the sentence from left to right. n is positive integer.
Here are the tests for this challenge:
ASIC_SP 0 points · Apr 2018 · learnbyexample
what is the error you get?
you need to be careful in not trying to deleting out of range index.. for example, the
"Hi!",100test caseBen_HH [OP] 1 points · Apr 2018
This is my error
ASIC_SP 1 points · Apr 2018 · learnbyexample
yeah, that is also a possibility..
and the error msg is self explanatory, if you have a list, say
[1, 3, 5]and try to get index of an element which doesn't exists, say2, you'll get this error..you can avoid this by adding
if '!' in charactersto while condition... also, you can useremovemethod instead of getting index and usingdel..but for this exercise, please use already existing string method :)