+ 3
Very Simple Python Problem - Help?
Hello everyone, I’m stuck on a string problem in the python for beginners course. It looks like my code output is the same as the desired result but it is incorrect somehow. This is my code: Print (“* \n** \n*** \n****”) My output: * ** *** **** Desired output: * ** *** **** How can I correct my code? I’ve checked to make sure there are no additional spaces as well. Thank you! Ryan
2 Réponses
+ 8
Ryan Grant ,
this is the code that is provided from sololearn:
print("* ** *** ****")
most of the users insert new-line sequences '\n', but do not remove the spaces. this creates a problem in the code coach test cases.
so we have to remove ALL spaces in the string!
+ 4
Sometimes sololearn is a little buggy and just running it again makes one pass the test cases. 🤷♀️
edit:
in your code example, there seem to be white spaces before \n. Did you remove them in your actual code?