Category Archives: Basic Programs in Python

Palindrome Program in Python

Task: Write a Python program to input a string and check it for Palindrome or not. The source code of Palindrome Program in Python # Write a Python program to input # a string and check it for Palindrome # Author: www.EasyCodeBook.com s1=input(“Enter string to check for Palindrome:”) # get reversed string by string slicing… Read More »

Python Pounds to Kilograms Conversion Program

Python Pounds to Kilograms Conversion Program – This Python Programming Tutorial will explain the Python code to input weight in pounds and convert into kilograms. The Formula for the Pounds to Kilograms Conversion e will use the following formula to convert the given pounds in kilograms. 1 Pound = 0.453592 Kilograms or 1 lb =… Read More »

Python GCD code using math.gcd() Function

Python GCD code using math.gcd() function – This Python programming tutorial explains the method of finding GCD of two numbers using math module’s gcd() function. What is Python gcd() functin of math module The math.gcd(a,b) function return the greatest common divisor of the integers a and b. Therefore, gcd(a,b) function will calculate the largest positive… Read More »

Python Swap Two Variables Without Temp Variable

Python Swap Two Variables Without Third – This Python programmin tutorial explains the Python Swap Two Vaibles Without Third Variable progrm.   # Write a Python program to swap # the values of two variables without # using a third variable # Author: www.EasyCodeBook.com (c) num1= int(input(‘Enter The value of num1 Variable:’)) num2= int(input(‘Enter The… Read More »

Inches to Centimeters Python Program

Inches to Centimeters Python Program – This Python Tutorial provides the source code of Inches to centimeters conversion program in Python programming language. The source code of Python Program to Convert Inches to Centimeters # Write a program that asks the user # to enter height in inches. # The program should convert it to… Read More »