+ 1
Why does the time limit exceed and stop after the loop ends?
13 Antworten
+ 2
I rewrote the code. Is it how it is supposed to work?
https://code.sololearn.com/cc3ujC0N3774/?ref=app
+ 2
Time limit didn't exceed in mine. It just says
6
spy number
and then an error.
+ 2
Umm. what are you trying to do anyway? I will try and recode it.
+ 2
you're welcome!
Look up 'string slicing'. Ask if you still don't understand. Right now, I am too lazy to give an answer! lol
And here is a TIP: Avoid using global variables.
+ 2
I edited the code. Check it out. You should pass the variable as an argument instead of using global variables. This code doesn't change the value of the original inputNumber unlike the last one.
Look up why they are bad. I don't have enough experience and knowledge to answer that!
+ 2
Thanks!
+ 1
How do I fix the error then?
+ 1
It's not the final product. But to list the first character in the input, then remove it and print the first character again. Until there is nothing left of the string.
+ 1
what?
+ 1
S. C. THANKS!
+ 1
S. C. I have one question though. What does this line do:
inputNumber = str(inputNumber)[1:]
+ 1
Thanks, what else could I use and what's bad about them?
0
hu