Skip to content Skip to sidebar Skip to footer

Issue Appending Files Python

I am currently working on an open source project with the goal of producing a tetris game that can run in the terminal. I'm currently stuck on the third test. I have written code t

Solution 1:

Cloned the project to check this issue.

I suppose here's a simple code doing what they expected the programmer to do for the first two tasks ( and it'd be a good exercise to try and write it with list comprehensions and lambdas if you want to get more out of this project)

def tetris():

    command = input('')

    if command == 'q':
        exit()
    elif command == 'p':
        for i in range(0, 22):
            output = ''
            for j in range(0, 10):
                if j == 0:
                    output = '.'
                else:
                    output = output + ' .'
            if i != 21:
                print(output + '\n', end="")
            else:
                print(output)


if __name__ == '__main__':

    tetris()

For the third task, you'd just have to add another condition, checking if the input is 'g' and then pre-seting the matrix.


Post a Comment for "Issue Appending Files Python"