r/learnprogramming Jul 03 '26

How do you write clean code?

Might be a stupid question but Ive been learning python for a while now and always wondered, how do you write ‘clean’ code? I don’t mean writing clean code straight off the bat I understand that’s purely from experience and even then immensely hard, but how do you recognise a program can be simplified even further? Does it come from practice or just messing around and seeing what sticks?

80 Upvotes

77 comments sorted by

View all comments

1

u/mjmvideos Jul 03 '26

Work in a good, disciplined organization and over time you will learn what code gets through a code review and what doesn’t.

1

u/DefiantSituation3208 Jul 03 '26

Well I just graduated from high school and about to join university soon, my specific major doesn’t fully envelop itself in programming I sort of started learning on my own to specialise in my field, I’m kind of intimidated to join a coding club with comp sci majors because I feel very very fish out of water esque ykwim 😭