Telegram Web
⚠️ Daily Python Facts ⚠️

It is also possible to use the tuple() constructor to make a tuple.

thistuple = tuple(("apple", "banana", "cherry")) # note the double round-brackets
print(thistuple)

Output:
("apple", "banana", "cherry")


- @pythonpool -
⚠️ Daily Python Facts ⚠️

It is also possible to use the list() constructor to make a new list.

thislist = list(("apple", "banana", "cherry"))
print(thislist)


Output:
['apple', 'banana', 'cherry']


- @pythonpool -
⚠️ Daily Python Facts ⚠️

Reverse the order of the fruit list:

fruits = ['apple', 'banana', 'cherry']
fruits.reverse()
print(fruits)

Ouput:
['cherry', 'banana', 'apple']


- @pythonpool -
⚠️ Daily Python Facts ⚠️

Numpy
Numpy is a popular array – processing package of Python. It provides good support for different dimensional array objects as well as for matrices. Numpy is not only confined to providing arrays only, but it also provides a variety of tools to manage these arrays. It is fast, efficient, and really good for managing matrice and arrays.

- @pythonpool -
⚠️ Daily Python Facts ⚠️

OpenCV Python
OpenCV, a.k.a Open Source Computer Vision is a python package for image processing. It monitors overall functions that are focused on instant computer vision. Although OpenCV has no proper documentation, according to many developers, it is one of the hardest libraries to learn. However, it does provide many inbuilt functions through which you learn Computer vision easily.

- @pythonpool -
⚠️ Daily Python Facts ⚠️

FlashText
FlashText is another python library that offers easy search and replacement of words from documents. All FlashText needs is a set of words and string. Then it identifies some words as keywords and replaces them from Text Data. It is a very effective library. People who are struggling with word replacement can choose it with confidence.

- @pythonpool -
⚠️ Daily Python Facts ⚠️

BeautifulSoup
BeautifulSoup is a great python library. It is used for parsing. It can parse different broken HTML and XML documents, as well. It offers an easy way for web scraping by extracting direct data from HTML. Many professionals are really happy with its amazing performance. It can save quite a lot of time on your day.

- @pythonpool -
⚠️ Daily Python Facts ⚠️

Creating a sequence of numbers with skips.

>>> range(1,10,2)
[1, 3, 5, 7, 9]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Summing a sequence of numbers with skips.

>>> n = range(1,10,2)
>>> sum(n)
25

- @pythonpool -
Dive into Deep Learning

An interactive deep learning book with code, math, and discussions Provides NumPy/MXNet, PyTorch, and TensorFlow implementations

Google Colab: https://d2l.ai/chapter_appendix-tools-for-deep-learning/colab.html

Amazon sage maker: https://d2l.ai/chapter_appendix-tools-for-deep-learning/sagemaker.html

Run Locally on Jupyter Notebook: https://d2l.ai/chapter_installation/index.html

Personally I loved this book,because each section has an executable Jupyter notebook, where you can modify the code and tune hyperparameters to get instant feedback to accumulate practical experiences in deep learning.
⚠️ Daily Dose of Python ⚠️

Checking whether all elements in the sequence are Truthful

>>> all(a % 2==0 for a in range(0,10,2))
True


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Given each iterable we construct a tuple by adding an index.

>>> a = ['Hello', 'world', '!']
>>> list(enumerate(a))
[(0, 'Hello'), (1, 'world'), (2, '!')]


- @pythonpool -
⚠️ Daily Dose Of Python ⚠️

Concatenating iterable to a single string.

>>> a = ["python","really", "rocks"]
>>> " ".join(a)
'python really rocks'


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Combining two iterable of tuples or pivot nested iterables.


# Combining two iterables
>>> a = [1, 2, 3]
>>> b = ['a', 'b', 'c']
>>> z = zip(a, b)
>>> z
[(1, 'a'), (2, 'b'), (3, 'c')]

# Pivoting list of tuples
>>> zip(*z)
[(1, 2, 3), ('a', 'b', 'c')]

- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Getting sorted iterable (can sort by “compare” function).

>>> a = [1, 2, -3]
>>> sorted(a)
[-3, 1, 2]

>>> sorted(a,key=abs)
[1, 2, -3]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Splitting a single string to list.

>>> s = "a,b,c"
>>> s.split(",")
["a", "b", "c"]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Initializing a list filled with some repetitive number.


>> [1]* 10
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]


- @pythonpool -
2025/07/13 02:09:28
Back to Top
HTML Embed Code: