Language Selection

English French German Italian Portuguese Spanish

Programming With Python

Filed under
Development
  • Classic Python Interview Question: the Two Sum Problem

    This article is about a classic challenge that is often given in Python coding interviews. There are several different approaches you could take with this challenge, but the aim is to come up with a solution which has "reasonable" time complexity - i.e. given a large input it will complete within seconds rather than hours...

  • Reading HTML tables with Pandas

    The pandas read_html() function is a quick and convenient way to turn an HTML table into a pandas DataFrame. This function can be useful for quickly incorporating tables from various websites without figuring out how to scrape the site’s HTML. However, there can be some challenges in cleaning and formatting the data before analyzing it. In this article, I will discuss how to use pandas read_html() to read and clean several Wikipedia HTML tables so that you can use them for further numeric analysis.

  • Python 101 2nd Edition Released!

    I rewrote Python 101 almost completely from scratch. I used the original as a guide, but this book is completely fresh. It is based on Python 3.8 and covers lots of beginner and intermediate topics.

  • PyDev of the Week: Débora Azevedo

    This week we welcome Débora Azevedo (@pydebb) as our PyDev of the Week! Débora is active in the PyLadies and DjangoGirls groups as well as teaching Python at PyLadies workshops. Let’s spend some time getting to know her better!

    [...]

    I’m an educator. I love teaching, and I’m working now as an English teacher in my state’s public network. But I have also taught Python in some PyLadies workshops. I’m doing my master’s degree in Innovation in Educational Technologies. For the past months, I’ve been working on developing educational software to assist deaf children in their literacy process from a bilingual perspective, considering that here in Brazil they learn Brazilian Sign Language and also written Portuguese. In my free time, I like to invest in the community (which has invested so much in me). From meetings online to translating blog posts and managing social media profiles, one thing worth pointing out about me is the involvement in the Python community here in Brazil, especially with PyLadies Brazil, which I contribute the most to. My most beloved hobbies are reading (love both Agatha Christie and Sir Arthur Conan Doyle), playing guitar and singing. I also write sporadically in my blog (in Portuguese).

  • Use Python to solve a charity's business problem

    In my first article in this series, I described a problem of dividing bulk supplies into hampers of similar value to distribute to struggling neighbors in your community. I also wrote about how I enjoy solving small problems like this with small programs in various languages and comparing how they do it.

    In the first article, I solved this problem with the Groovy programming language. Groovy is like Python in many ways, but syntactically it's more like C and Java. Therefore, it should be interesting and instructive to create the same solution in Python.

    [...]

    Another issue worth mentioning: This isn't a particularly efficient approach. Removing elements from lists, being careless about repeated expressions, and a few other things make this less suitable for a huge redistribution problem. Still, it runs in a blink on my old machine.

    If you are shuddering at my use of while loops and mutating the data in this code, you probably wish I made it more functional. I couldn't think of a way to use map and reduce features in Python in conjunction with a random selection of units for repackaging. Can you?

    In the next article, I'll re-do this in Java just to see how much less effort Groovy and Python are, and future articles will cover Julia and Go.

  • Python vs R, Which is the Best Language for Data Analysis?

    The idea is to make sense of the data you have, to analyse it and share better business prospects in the near future and how you’re going to do it, is with the concepts of analytics. Data Science involves extraction of trends, patterns and useful information from a set of existing data which will be of no use if not analyzed. It is a kind of business intelligence that is now used for gaining profits and making better use of resources. This can also help in improving managerial operations and leverage organizations to the next level.

    If not analyzed this data is going to get wasted whereas if analyzed properly this data can help us in finding information that is powerful to bring in a change in the patterns of how business is already working or going. Just imagine a source of unleashed information exists and you haven’t dived in yet to get the grip of it. Your business can take a competitive advantage of it and do wonders with the data. This is going to extract insights that will allow an advantage to a business or an organization in an economy.

  • Song-basket

    I threw together a Spotify API program called song-basket. I have a few large themed playlists (for example, Instrumental Funk). This app is to help me add songs to them. I can choose a playlist (the basket), and then as I surf around Spotify, it lets me add the current song to the basket with one click. It also shows me whether the current song is already in the basket or not, which they often are. If the song is already in the basket, I don’t have to think about whether to add it, and I don’t have to deal with the annoying “Add duplicate?” question.

More in Tux Machines

digiKam 7.7.0 is released

After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release. Read more

Dilution and Misuse of the "Linux" Brand

Samsung, Red Hat to Work on Linux Drivers for Future Tech

The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world. Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.