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 = […]
Category: Python
Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991…
In this category, we will cover topics like data types, operators, keywords, functions, loops, conditional statements, etc….
Python – Program to Find Area of a Circle
In this post, we will write a program for how to calculate the area of a circle in python. First, let’s see What is the Area of Circle? The area enclosed by a circle of radius r in 2-dimensional plane. Formula: Area of circle: A = pi * r * r Or pi * r […]
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 calculate Compound Interest
In this post, we will write a program for how to calculate compound interest in python. First, let’s see What is compound Interest? Compound Interest is also called compounding interest which is calculated on the principal (initial principal) that is the addition of interest to the principal sum of a loan or deposit. The formula […]
Python – program to calculate simple interest
In this post, we will write a program for how to calculate simple interest in Python. First, let’s see What is Simple Interest? Simple interest is an interest calculated on the principal amount of a loan or the original contribution to a savings account. Simple Interest: I = (P * R * T) / 100 […]
Operators in Python
Operators are used to performing operations on values. Operators in Python are divided into the following categories : Arithmetic operators Assignment operators Logical operators Comparison operators Identity operators Membership operators Bitwise operators Arithmetic operators: These operators are used to perform mathematical operations (addition, subtraction, multiplication, division) on numerical values. “+”: This operator is used to […]
Python – program to print odd natural number upto n
In this post, we will see programs for how to print odd natural numbers up to n in python, provided n is positive. Odd Number : Any integer either positive or negative, which can not be divided exactly by 2 is an odd number. The numbers having the last digit is 1, 3, 5, 7 […]
Python – program to print first n odd natural numbers
In this post, we will see how to print first n odd natural numbers in python? Odd Numbers: Any integer that is positive or negative which can not be divided exactly by 2 is an odd number. The numbers having the last digit is 1, 3, 5, 7 or 9 are odd numbers. Note: Natural […]
Python Lists
The List is a collection of heterogeneous data type that is ordered and changeable i.e. mutable. It allows duplicate members. Creation of list: Using square brackets: Output: [] [‘apple’, ‘orange’, ‘kiwi’] Using list() built-in function: Output: [] [‘a’, ‘p’, ‘p’, ‘l’, ‘e’] Access elements of the list: We can access any element from the list […]
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 […]