Renan Moura

Renan Moura

I'm a Software Engineer working in the industry for a decade now. I like to solve problems with as little code as possible. I’m interested in solving all sorts of problems with technology in creative and innovative ways. From everyday shell scripts to machine learning models. I write about Software Development, Machine Learning, and Career in tech.

isdigit(): checking digits only in a string in Python

how to python

Use the isdigit() method to check if a string only contains digits. Digits include numbers from 0 to 9 and also superscripts and subscripts. word = '32' print(word.isdigit()) #output: True print("\u2083".isdigit()) #unicode for subscript 3 #output: True word = 'beach'…

isnumeric(): checking numerics only in a string in Python

how to python

Use the isnumeric() method to check if a string only contains numeric chars. Numerics include numbers from 0 to 9 and combinations of them, roman numerals, superscripts, subscripts, fractions, and other variations. word = '32' print(word.isnumeric()) #output: True print("\u2083".isnumeric()) #unicode…

How to swap two variables in Python

how to python

In this post I will show how to swap the values of two variables. The first way is very common in many languages and require the use of a third variable. The second and recommended way is what they call…