Avatar ·

How to create a postgreSQL database?

📁 Help, Flask microframework

There is an application (blog), how to create a postgreSQL database. The code is fully working, source code on GitHub. Everything seems clear, except for one thing - How to create this very db? The application itself runs on a local server using virtualenv

Although there is a "text hint" in the readme, I don't understand where to insert this very text hint?

The source code itself:

Avatar ·
from collections import Counterword = 'приоритет'c = Counter(word)print(c.most_common(1)[0][0])

Since the most_common method returns a list of the most frequent values (even if we requested only one most frequent value), we need to take the first element (that's why the first [0] is needed). Each element in this list is a pair (element, count), so we need to take the first element again.

In general, in the word "приоритет" there are 3 letters that appear twice (р, и, т), it will output only one of them (it output "р" for me).

Solution variant without

Log in to leave an answer

Blogs