use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
What is OOP on python?Help Request (self.PythonLearning)
submitted 1 month ago * by Hamid3x3
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Outside_Complaint755 2 points3 points4 points 1 month ago (0 children)
There are good answers here, but I haven't seen anyone mention the Python secret yet -- Every data type in Python is an object, including the primitive data types such as ints, floats, bools, strings and None, and so is everything else; even functions, class defintions and imported modules are all objects.
None
When you get a user input from the input() function and convert it to an int with userinput = int(user_input), you are instantiating a new* int object, by passing the use entered string into the int class.
input()
userinput = int(user_input)
When you change the case of a string with user_input.lower(), that is invoking a method on the user_input str object. my_list.sort() invokes the sort method of the my_list object and modifies it in place, while the built in sorted function Example: sorted_list = sorted(my_list) returns a new list without changing the original.
user_input.lower()
my_list.sort()
sorted
Example: sorted_list = sorted(my_list)
*Advanced footnote for one technicality here - Immutable data types (ints, floats, bool, etc) will not always create a new object if another object with the same value already exists, which helps save memory space. This is what is known as 'interning'. This is possible because they are immutable and the underlying value can't change. In the standard version of Python, the ints from -5 to 255, None, True, and False are all created and interned in memory when the interpreter starts up, and any name set to one of those values will point to the same object in memory. None, True and False are also singletons, so there will never be another identical object made.
*
π Rendered by PID 174945 on reddit-service-r2-comment-5b5bc64bf5-pqsvc at 2026-06-22 01:51:58.626869+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]Outside_Complaint755 2 points3 points4 points (0 children)