Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

breeanneschill Group Title

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.

  • one year ago
  • one year ago

  • This Question is Open
  1. JJTraylor Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Hi BreeAnne, Can you cut and paste the lines of code that you have entered? Or attach your tictactoe.py file?

    • one year ago
  2. ramc Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Try using an IDE for that. You can use IDLE ( WIndows and Linux ) or even VIM and gedit as your IDE for Linux.

    • one year ago
  3. KonradZuse Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • one year ago
  4. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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

    • one year ago
  5. lowsypunk Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • one year ago
  6. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    For output, maybe you are looking for the newline character? "\n" print works different in 2.x as opposed to 3.x as well.

    • one year ago
  7. hduff Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    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. Example: 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” Or as spam = “porkstuff” + “beefstuff” + “red dye” + \ “mysterious chemical” + “filler” + \ “assorted other stuff”

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.