Ask coding questions

← Back to all posts
Have a problem with only this IDE.
thongth (0)

This program works very well on another site but it keep failing when I tried to run it on this site. (it doesn't print out the result in line 2 in the given picture) Is there any reasons to this?
You can try it yourself if you want to.
Ps. The picture shows how I want the program to be. (And it was on another site)

Answered by JoshDaBosh (78) [earned 5 cycles]
View Answer
JoshDaBosh (78)

@thongth change the last 2 lines to just this:
print(*lisR, sep=" ")

thongth (0)

@JoshDaBosh Wow, It really works. Do you have any idea why it didn't print anything at first whilst others did.

JoshDaBosh (78)

@thongth it's something to do with the end=" " and how handles it. (I was super confused as well lol)
The "*" in my line is just python "shorthand" for all elements in that list. I've tried using end="\n" and sep=" " in your original code's last line and it works. is funny sometimes :\

amasad (2470)

@JoshDaBosh Sorry about that. It shouldn't be funny at all. We'll fix it today. Let us know here or email me directly if anything is ever funny [email protected] (I'm the ceo)

pyelias (1471)

This seems to have something to do with newline buffering. Add a print() after and it'll work fine.

OwenBradstreet (100)

@pyelias You can also set the flush argument to true flush=True inside the print, which forces the terminal to buffer after each one :)

coderam (0)

I just noticed that when using a Python repl, the print statement with end =" " works fine. However, if the same is used in a "Python(with Turtle)" repl, we still get a ParseError. Is this difference in parsing expected?

amasad (2470)

hey all, pushing a fix for this in an hour. should always do the right thing, and we're very sorry for this bug.

timmy_i_chen (1087)

Correction: this should be fixed soon! Will ping as soon as it's fixed.

timmy_i_chen (1087)

Thanks for helping guys, @thongth the end=" " is a known problem and will be fixed as soon as we ship the new terminal (almost released) :)

JoshDaBosh (78)

What's the error? If it's the print statement giving you issues, try switching to python3 instead of python2.