Created
May 13, 2021 10:41
-
-
Save Praneeth313/21472759799fa8dfad785d6a01d2c872 to your computer and use it in GitHub Desktop.
Pirple - Python is Easy Assignment 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Create a function that takes in two parameters: rows, and columns, both of which are integers. | |
The function should then proceed to draw a playing board (as in the examples from the lectures) | |
the same number of rows and columns as specified. After drawing the board, your function should return True. | |
""" | |
""" | |
Define a function which takes two parameters rows & cols | |
""" | |
def tictactoe(rows,cols): | |
""" | |
Using for loop and if statments write a program to create a tic-tac-toe board with | |
same number of rows and columns. | |
""" | |
""" | |
Set the max number of columns to 93 to avoid wrapping | |
""" | |
if cols<=93: | |
for row in range(rows): | |
if row%2 == 0: | |
for col in range(cols): | |
if col%2 == 0: | |
if col != (cols-1): | |
print(" ",end = "") | |
else: | |
print(" ") | |
else: | |
if col != (cols-1): | |
print("|",end = "") | |
else: | |
print("|") | |
else: | |
print("-"*cols) | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment