Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

walne

  • 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