void main() is not portable
Although it "works" in a lot of cases, the only two portable definitions of main are:
int main(int argc, char **argv)
You don't check the return value of scanf.
This would be better:
if(scanf("%d", &n) != 1)
fputs("Error; enter a number.", stderr);
return EXIT_FAILURE; /* ...
First of all, I suggest you read pep8 (https://pep8.org/). I see you have violations. Understanding pep8 is a must if you want to be a pro Python developer. Better yet, use flake8 to automatically find pep8 violations in your code.
Second, using that many elif statements is always a red flag, especially when they seem to be doing the same thing. Can you ...
In no particular order:
Comments on what the variable names represent would be helpful, if for no other reason than to encourage more thought about your data model -- if it's hard to describe what each variable contains, maybe there's a way to store your data that's less confusing?
p1 and p2 look like static values, so I'd suggest making them class ...
Ways of improving/optimizing:
prefer enumerate(board) over redundant list(range(len(board)))
all conditional branches within for loop have the same common expression to append ' ' + str(board[number]) + ' '. Thus, it can be moved up to reduce conditional branches
prefer flexible f-string formatting over awkward string concatenation ...
There are a lot of if and elif statements here. You can reduce this by utilizing python's any built in function. This will return True if any of the values passed in are True. And since you have a bunch of expressions that evaluate to boolean values, this can be rewritten like so:
def check_win(board, letter):
As others have mentioned, python has a style guide, PEP8. It's very useful for yourself and people reading your code if you follow this guide as it makes your code consistent, readable and idiomatic.
You have some typos and warnings in your code which show up immediately in my editor. It's worth looking at using an IDE to see these while you're writing. ...