A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 3 years ago

In hwk 1.3 It gives the instructions: "Write a program that prints out the tic-tac-toe board from exercise 1.2, but uses variables to cut down on the amount of typing you have to do. What I wrote below outputs the correct answer; but it seems so inefficient to have to write print 5 times. Is it possible to print the output of multiple variables and have them jump down to the next line each time? a = " | |" b = "--------" print a print b print a print b print a

  • This Question is Closed
  1. estudier
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    I guess usually you would use some loop around print a and print b. You can put print a + "\n" + b for a new line.

  2. walne
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Great advice @estudier I used the "\n" to create this which printed the tic-tac-toe design perfectly: print a + "\n" + b + "\n" + a + "\n" + b + "\n" + a

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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...


  • 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.