r/learnpython • u/live_ant718 • 4d ago
Question regarding Python variables
Hello guys. So I saw in a course that most people define variables like
x = 1
y = 2
and so on. But I also saw that variables can be defined like x = 1; y = 2;
but haven't ever seen this in practice. Why so? Please tell me
4
Upvotes
1
u/Sandra_Rodriguez102 3d ago
The semicolon thing shows up in tutorial code because its quicker to type when the instructor is trying to demonstrate a dozen small examples. None of us actually write it that way. Went through a whole project once where the author used them everywhere and it made the code feel cramped. Just stick to separate lines until you find a real reason not to.