r/PythonLearning • • 13d ago

What do you guys think?

Post image

I made a program that finds the second largest digit in a list.

Using the list method "remove()" and "max" function. Python is COOL!

88 Upvotes

58 comments sorted by

View all comments

Show parent comment

6

u/Potential_Fix_5007 13d ago

But you have to keep in mind, that sorted() creates a new list so the original list is still chaotic. That can be intentional.

2

u/NoMakeSenseOk 13d ago

I should've mentioned this, since every new list or copy thereof increases memory usage. For less memory usage we use references rather than copies.

2

u/Potential_Fix_5007 13d ago

You are right but as far as i know "memory usage" is a topic you dont need to keep an eye on while learning. Early projects will nearly always count as "low memory" so dont panic over this directly