Python

Python program to calculate the reverse of an integer number without using strings

In this post, I’ll show a Python program to calculate the reverse of an integer number without using strings. One reason for not using strings is that we want to focus on the algorithm instead of getting a solution we don’t fully understand. The other one is that converting big numbers to strings is a […]

Python program to calculate the reverse of an integer number without using strings Read More »

Python program to calculate the greatest common divisor using the Euclidean Algorithm

The Euclidean Algorithm to calculate the greatest common divisor (GCD) has many applications. We use it in programming class for two reasons: to practice loops and recursion, and to promote algorithmic thinking. In this post, I’ll give you a description of the algorithm, as well as a few different implementations for you to practice loops

Python program to calculate the greatest common divisor using the Euclidean Algorithm Read More »

Palindrome in Python

Let’s examine how to determine whether a word or sentence is palindrome or not in python. Words and/or sentences are palindrome when you can read them from beginning to end and vice versa and have the same meaning. In the case of sentences, we don’t consider the spaces and punctuation. Some examples are: Civic Radar

Palindrome in Python Read More »