[Collection] All Finxter Articles and Tutorials

Cómo convertir una lista de enteros en una lista de cadenas en Python

English version of article (English): https://blog.finxter.com/how-to-convert-an-integer-list-to-a-string-list-in-python/ La forma más pitónica de convertir una lista de enteros ints en una lista de cadenas es usar el código de una línea strings = [str(x) for x in ints]. Recorre todos los elementos de la lista ints y convierte cada elemento de la lista x en una cadena … Read more

​Read More
Cómo convertir una lista de enteros en una lista de cadenas en Python

Proper Indentation for Python Multiline Strings

Table of Contents Python Mutliline StringsThe ‘Triple Quotes’ MethodIndentation with textwrap.dedentIndentation With inspect.cleandocThe ‘Brackets’ MethodThe ‘Backslash’ MethodSummary Python Mutliline Strings In this article we are going to look at how to properly indent your code for Python multiline strings, so let’s start by clarifying what a multiline string is and why indentation is important. Readability … Read more

​Read More
Proper Indentation for Python Multiline Strings

Python Dictionary values() Method

Table of Contents DefinitionSyntaxBasic ExampleSum Over All Values in a Dictionary with dict.values()Get List of Values with dict.values() Definition The dict.values() method returns an iterable dictionary view object of all the values in a dictionary. Syntax dict.values() Parameters The dict.values() method does not take any parameters. Return-Value The dict.values() method returns an iterable dictionary view … Read more

​Read More
Python Dictionary values() Method

Python Dictionary update() Method

Table of Contents DefinitionSyntaxBasic ExampleAdd Key Value Pair to Python DictionaryPassing a Tuple to dict.update()Merge Two Nested Dictionaries with dict.update() Definition The dict.update() method updates a dictionary with a (key-value) pair element from another dictionary, or from an iterable of (key-value) pair elements. Syntax dict.update([dictionary/iterable]) Parameters The dict.update() method inputs either an iterable object of … Read more

​Read More
Python Dictionary update() Method

Python Dictionary setdefault() Method

Related Tutorial: Python Dictionary Methods Table of Contents SyntaxExample setdefault()Example Key Does Not ExistExample Setting Default Valuesetdefault() vs defaultdict() Syntax dict.setdefault(key, default_value) Parameters The dict.setdefault() method takes two parameters, the key and the default_value of the key. The default value is optional. Return Value Returns the value associated with the passed key. If the key … Read more

​Read More
Python Dictionary setdefault() Method

Python Dictionary popitem() Method

Related Article: Python Dictionary Methods Table of Contents DefinitionSyntaxExample: Remove and InsertPython dict.popitem() Empty DictionaryLIFO Order of dict.popitem()While Loop dicts.popitem() Definition The Python method dict.popitem() removes and returns the last (key-value) pair element that was inserted in the dictionary. Syntax dict.popitem() Parameters The dict.popitem() method does not take any parameter inputs. Return-Value The dict.popitem() method … Read more

​Read More
Python Dictionary popitem() Method

Python Dictionary pop() Method

This Python article covers the Python dictionary pop() method, specifically, its definition, syntax, parameter(s), and return type. Additionally, we’ll provide some examples on how dict.pop() is used in practice. So, let’s get started! 🙂 Related Article: Python Dictionary Methods Table of Contents DefinitionSyntaxExample 1: Key ExistsExample 2: Key Doesn’t ExistExample 3: Default ValueExample 4: dict.pop() … Read more

​Read More
Python Dictionary pop() Method

Saleor – Create Your First Storefront App in Python

Quick Overview Saleor is a full-fledged e-commerce platform, and it has features including the management of customers, orders, products, shipping, site administration, among others. Saleor was built using Python and the Django Framework and uses a GraphQL API. It is a headless system, which means that it can be used with different types of front-end … Read more

​Read More
Saleor – Create Your First Storefront App in Python

Python __eq__ Magic Method

To customize the behavior of the equality operator x == y, override the __eq__() dunder method in your class definition. Python internally calls x.__eq__(y) to compare two objects using x == y. If the __eq__() method is not defined, Python will use the is operator per default that checks for two arbitrary objects whether they … Read more

​Read More
Python __eq__ Magic Method

Python __invert__() Magic Method

Table of Contents SyntaxBackground Bitwise NOT ~Example Custom __invert__()TypeError: bad operand type for unary ~: ‘…’Where to Go From Here? Syntax object.__invert__(self) The Python __invert__() method implements the unary arithmetic operation bitwise NOT ~. So, when you cal ~x, Python will internally call x.__invert__() to obtain the inverted object. If the method is not implemented, … Read more

​Read More
Python __invert__() Magic Method

Python __int__() Magic Method

Table of Contents SyntaxBackground int()Example Custom __int__()TypeError: int() argument must be a string, a bytes-like object or a number, not ‘…’TypeError: __int__ returned non-int (type str)Fallback Method __index__() for int()Where to Go From Here? Syntax object.__int__(x) The Python __int__() method implements the built-in int() function. So, when you call int(x), Python attempts to call x.__int__(). … Read more

​Read More
Python __int__() Magic Method

Python Palindromes One-Liner

This one-liner introduces another basic computer science term: palindromes. Similar to anagrams, palindromes are a popular coding interview question. First things first: Table of Contents What is a Palindrome?Problem FormulationPython Palindrome Checker in One LineHow the Python Palindrome Checker WorksPython Palindrome Checker Ignoring Whitespace and CapitalizationPython One-Liners Book: Master the Single Line First! What is … Read more

​Read More
Python Palindromes One-Liner

Iterative Deepening Depth-First Search (DFS) Algorithm in Python

Table of Contents What is an Iterative Deepening Depth-First Search Algorithm?What is the Purpose of Iterative Deepening DFS?How Does Iterative Deepening DFS Work?What Are the Properties of Iterative Deepening DFS?How is Iterative Deepening DFS Implemented in Python?Efficiency AnalysisConclusion What is an Iterative Deepening Depth-First Search Algorithm? Continuing our story even further, after introducing graphs and … Read more

​Read More
Iterative Deepening Depth-First Search (DFS) Algorithm in Python

Finxter.com Puzzles by Topic

Arithmetic Arithmetic Operations https://app.finxter.com/learn/computer/science/314 Integer Arithmetic https://app.finxter.com/learn/computer/science/381 Python Float Arithmetic https://app.finxter.com/learn/computer/science/320 OOP Basics of OOP https://app.finxter.com/learn/computer/science/527 OOP https://app.finxter.com/learn/computer/science/606 OOP – Representation https://app.finxter.com/learn/computer/science/594 Filter Filter and Recursion https://app.finxter.com/learn/computer/science/493 Set, Lambda, and Filter https://app.finxter.com/learn/computer/science/399 The Filter Function https://app.finxter.com/learn/computer/science/375 DataFrames DataFrames and Datatypes https://app.finxter.com/learn/computer/science/614 DataFrames and Series https://app.finxter.com/learn/computer/science/612 Merging DataFrames https://app.finxter.com/learn/computer/science/621 Add Column To DataFrame https://app.finxter.com/learn/computer/science/616 DataFrame Creation … Read more

​Read More
Finxter.com Puzzles by Topic

Python __float__() Magic Method

Table of Contents SyntaxBackground float()Example Custom __float__()TypeError: float() argument must be a string or a number, not ‘…’TypeError: Data.__float__ returned non-float (type …)Fallback Method __index__() for float()Where to Go From Here? Syntax object.__float__(x) The Python __float__() method implements the built-in float() function. So, when you call float(x), Python attempts to call x.__float__(). If the return … Read more

​Read More
Python __float__() Magic Method

Cómo convertir una lista de cadenas en una lista de números en coma flotante (flotantes) en Python

La forma más pitónica de convertir una lista de cadenas en una lista de flotantes es usar una comprensión de listas floats = [float(x) for x in strings]. Recorre todos los elementos de la lista y convierte cada elemento de la lista x en un flotante utilizando la función incorporada float(x). Este artículo muestra las … Read more

​Read More
Cómo convertir una lista de cadenas en una lista de números en coma flotante (flotantes) en Python

Python Anagrams in One Line Python

Table of Contents Why Learning about Python Anagrams?Problem FormulationAnagram CheckerBackground sorted()Where to Go From Here?Python One-Liners Book: Master the Single Line First! Why Learning about Python Anagrams? A popular question in programming interviews is to create an anagram checker. The interviewer wants to test your knowledge about the basic terminology in computer science, and how … Read more

​Read More
Python Anagrams in One Line Python

Introduction to Web3.py

This article will give you a quick overview of a Python library, Web3.py. By the end of this article, we will install it on our local computer and understand how to use the basic functionality, such as sending Ether, deploying a Smart Contract, and interacting with it in Python. Table of Contents What is Web3.py?How … Read more

​Read More
Introduction to Web3.py

Python Working with the Pandas DataFrame & MySQL – Part 3

Table of Contents Background & Getting StartedCreate USE QueryCreate MySQL Database TableInsert Records into MySQL TableThe next step is to read in the CSV file crimes_01.csv and assign it to a DataFrame.Summary Background & Getting Started Part 3 of this series centers around creating a MySQL table and inserting records from the CSV file referenced … Read more

​Read More
Python Working with the Pandas DataFrame & MySQL – Part 3

NFT 101

NFTs have taken the world by storm attracting the masses outside the hardcore crypto enthusiasts. What is all the fuss about anyway? Can’t you just right-click and save the artwork anyways? Investors, celebrities, artists, and collectors are flocking to this new marketplace. Despite it’s name, you’ll find tons of fun in the non-fungible token space. … Read more

​Read More
NFT 101

Argent Review

New users are often intimidated upon entering the crypto space. Hurdles like user-friendliness, private keys, encryption, and wallets is enough to make a beginner’s head spin. With so many complexities to start off, it’s no wonder why mass adoption is slow to come. Table of Contents Design/UXGetting StartedUsabilityFeaturesETH AssetsCheck Out Argent WalletLearn Solidity Course Design/UX … Read more

​Read More
Argent Review

Cómo convertir una lista de cadenas en una lista de enteros en Python

El modo más pitónico de convertir una lista de cadenas a una lista de enteros es utilizar la comprensión de listas [int(x) for x in strings]. Recorre todos los elementos de la lista y convierte cada elemento de la lista x en un valor entero utilizando la función incorporada int(x). Este artículo muestra las formas … Read more

​Read More
Cómo convertir una lista de cadenas en una lista de enteros en Python

Python __hash__() Magic Method

Table of Contents SyntaxBackground hash()Example Custom __hash__()Default __hash__()TypeError: __hash__ method should return an integerGood Practices __hash__Where to Go From Here? Syntax object.__hash__(x) The Python __hash__() method implements the built-in hash() function. So, when you cal hash(x), Python attempts to call x.__hash__(). If the return value is not an integer or the x.__hash__() method is not … Read more

​Read More
Python __hash__() Magic Method

Python __complex__() Magic Method

Table of Contents SyntaxBackground complex()Example Custom __complex__()TypeError: complex() first argument must be a string or a number, not …TypeError: __bool__ should return bool, returned …Where to Go From Here? Syntax object.__complex__(x) The Python __complex__() method implements the built-in complex() function. So, when you cal complex(x), Python attempts to call x.__complex__(). If the return value is … Read more

​Read More
Python __complex__() Magic Method

Python math.factorial()

This article is an edited version of this article on the Finxter blog. The math.factorial() function is one of many functions in the math module. In this article, we will explore the mathematical properties of the factorial function using Python’s Matplotlib and NumPy libraries. Table of Contents What is the Factorial Function?Asymptotic Behavior of the … Read more

​Read More
Python math.factorial()

Python Working with the Pandas DataFrame & MySQL – Part 2

Table of Contents BackgroundGetting StartedRead CSV FileInsert a DataFrame ColumnConnect to MySQLCheck the Login Credentials ManuallyCheck the Login Credentials via PythonCreate a MySQL DatabaseSummaryNext Up Background Part 2 of this series centers around running more complex MySQL queries. This skill is a must-have if you are interested in pursuing a career as a Data Scientist. … Read more

​Read More
Python Working with the Pandas DataFrame & MySQL – Part 2