Bob Belderbos | @bbelderbos@fosstodon.org Profile picture
Software developer passionate about building useful tools and helping people grow their #Python and #programming skills through @Pybites

Apr 14, 2022, 22 tweets

20 cool things you can do with #Python's built-in functions šŸšŸ§µ

1. Make a dictionary from two lists:

2. Get a counter when looping through a sequence:

3. Check if a condition holds true for any or all items in a sequence:

4. Print things:

5. Summing values:

6. Uniquify a list:

7. Reverse a list:

8. Make a range of integers with a step:

9. Get a quotient and remainder, for example to divide seconds into minutes + seconds:

10. Name and apply a slice:

11. Use dir() together with a list comprehension to only list "public" methods (and attributes) of an object:

12. Get the min and max of a sequence:

13. Get user input:

14. Check for, get and set attributes:

15. Call a method on the parent class:

16. Use next() to retrieve the next value from a generator:

17. Make values absolute:

18. Sort values, by key, reversed, and in-place:

19. Round numbers:

20. See the representation / string of an object:

Python docs:
docs.python.org/3/library/func…

@PyBites YouTube training:

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling