+ 2
Why does \n not work?
EDIT: This is now solved, thank you very much It's probably weird to be so excited, but I just defined my first function!! This seemed so difficult for me. Can somebody tell though why the line continuation \n doesn't work and what I could do instead of print(" ") on every line I want to jump? Thank you https://code.sololearn.com/cTRBFaHeS2VV/?ref=app
15 Answers
+ 4
Hello,
Congratulations on making your first function. I do not know what your code looks like, and therefore I can't tell exactly why it is not working.
But, the mistake I had, is that I didn't put "\n" inside speech marks (" "). Which you might have.
Can you post your code in here, so it can be analysed and a solution be suggested for you?
+ 4
😎 Show us your code
+ 2
Use print (f"[ h:{h} w:{w} d:{d} ]")
instead of print("h:" + str(h)+" w:"+str(w)+" d:"+"33.0")
+ 2
Try this for each one of them:
print("\n[]\n")
calc_expedit(1,1)
print("\n[][]\n")
calc_expedit(2,1)
calc_expedit(2,1)
print("\n[][]\n")
calc_expedit(1,2)
calc_expedit(1,2)
\n before [] will make it so there is a line break between the previous [] and this []. \n after [] will make it, so there's a line break after this line. Just put \n at the end/start of the strings, where boxes are
+ 1
So, you want each of [ ] on a new line?
UPD: oh, I see what you want, give me a minute
+ 1
0
Lamron , no, I would like it to look how it looks now but would like to not have to use a print(" ") every single time
0
First:
print("\n") Is printing new line
Second:
Why you want print "[]" ?
0
Thanks Lochard that's a lot shorter 😁
0
Václav Dostál The "[]" are the boxes I need to fit into the Kallax Cubbie. I need to see the arrangement
0
print("Hello\nWorld!")
0
Sarah I made one that requires different input.
https://code.sololearn.com/cyIBw8MFYwgH/?ref=app
0
O Abi