Curious how to write code on several lines. For example, in the exercise with tic tac toe lines. I can only get them on one line and not as a tic tac toe table.
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
Can you cut and paste the lines of code that you have entered?
Or attach your tictactoe.py file?
Try using an IDE for that. You can use IDLE ( WIndows and Linux ) or even VIM and gedit as your IDE for Linux.
Well if you mean display output on several lines... In Java there is Println and Print. Print just prints on one line, while Println prints on multiple lines. I believe this is the same or about for most languages. C uses printf I believe.
Not the answer you are looking for? Search for more explanations.
If it is something contained in parentheses you can just continue on the next line like this
some random code to do something (10, 23, 556, 78,
32, 45, 78)
Other wise you can use the backslash character "\" like below
some random code that does something but the line is long so \
some more random code that is part of the same line
to have things output from a script onto multiple lines, use multiple lines of "print" commands. each "print" command will output on a new line. let me know if this works for you.
For output, maybe you are looking for the newline character? "\n" print works different in 2.x as opposed to 3.x as well.
I’m a newbie but I think you can handle long lines of code in either of two ways. Given how Python uses white space you can just break your code over more than one line. Or you can use a back slash.
spam = “porkstuff” + “beefstuff” + “red dye” + “mysterious chemical” + “filler” + “assorted other stuff”
could be typed as:
spam = “porkstuff” + “beefstuff” + “red dye” +
“mysterious chemical” + “filler” +
“assorted other stuff”
spam = “porkstuff” + “beefstuff” + “red dye” + \
“mysterious chemical” + “filler” + \
“assorted other stuff”