Python – Different ways to Reverse a String

In this post, We will see different ways to Reverse a string in Python. Code 1: Using the concept of string-Slicing. Output: Reverse String: nohtimehcoiB Code 2: Using the concept of Looping and string-Concatenation. Output: Reverse String: nohtimehcoiB Code 3: Using the concept of Reverse Looping. Output: Reverse String: nohtimehcoiB Code 4: Using reversed(),list() and […]

Python – Program to Find Circumference of a Circle

In this post, we will write a program for how to calculate circumference of a circle in python. First, let’s see What is Circumference of Circle? The perimeter is the curve length around any closed figure. Formula: Circumference of Circle: C = 2 * pi * r Where, r = Radius of circle pi = […]

Data Types in Python

As we know Python is an object-oriented programming language so everything is considered as an object in Python, data types are actually classes and variables are instance (object) of these classes. Depending upon the properties, there are manly 7 basic data types: 1. Numbers: This datatype mainly has a numerical value. Integer Float Complex Output: […]

Python – program to print first n even natural numbers

In this post, we will see how to print first n even natural numbers in python? Even Numbers: Any integer that is positive or negative which can be divided exactly by 2 is an even number. The numbers having the last digit is 0, 2, 4, 6 or 8 are even numbers. Note : Natural number is positive integers. It’s range […]