r/PythonLearning • • Aug 17 '25

What's wrong

Post image
49 Upvotes

45 comments sorted by

View all comments

Show parent comments

9

u/coopsoup247 Aug 17 '25 edited Aug 17 '25

In addition, the script can also be shortened to this:

l=[9,2,3,6,5]
for i in l:
    print(i)

EDIT: cleaned up the formatting

2

u/ilidan-85 Aug 17 '25

It can but it doesn't mean it should. We should write readable code for ourselves in future and others. Clean, readable code is gold!

1

u/therouterguy Aug 17 '25

What is not readable about this?

1

u/coopsoup247 Aug 17 '25

I originally wrote it on my phone. Even though I put in line breaks, Reddit removed them, so it put the whole script on one line, which looked messy.

I edited it after to correct it.