Category Archives: Python Programs with Functions

Python Convert Millimeters to Inches using Function

Python Convert Millimeters to Inches using function – This Python program will input millimeters  from the user. It will convert mm into inches. The Formula To Convert mm into Inches To convert millimeters into inches, Multiply millimeters by 0.0393701 or divide millimeters by 25.4. Source Code – Python Function To Convert mm to Inches #Python… Read More »

Loading

Python Print Star Patterns 14 Programs

Python Print Star Pattern Shapes – In this Python Programming tutorial, we will discuss printing different star patterns, shapes, pyramids, triangles, squares etc using nested for loops. The Program Logic Normally we use nested for loops to print star shapes in Python. For example, the following Python program will need two nested for loops. The… Read More »

Loading

Python Simple Calculator Program

Python Simple Calculator Program demonstrates a four function basic calculator. This Python program provides the functionalities of:  Addition  Subtraction  Multiplication and  Division of two numbers. Code for Simple Calculator Program # This is a simple Python program # to design a simple 4 function # calculator using if -elif- else # define functions def add(x,… Read More »

Loading

Python Recursive Function Check Palindrom String

Python Recursive Function Check Palindrom String # Write a Python program to # input a string and find # whether the string is a palindrome or not # www.easycodebook.com # Start of the Python program # define the recursive function def is_palindrome(s): if len(s) <= 1: # Base case return True elif s[0] != s[len(s)… Read More »

Loading