Pavitra has Published 145 Articles

Python Program to convert Kilometers to Miles

Pavitra

Pavitra

Updated on 23-Dec-2019 07:37:08

345 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given distance in kilometers and we need to convert it into milesAs we know that 1 kilometer equals 0.62137 miles.Formula UsedMiles = kilometer * 0.62137Now let’s observe the concept in the implementation ... Read More

Python program to convert hex string to decimal

Pavitra

Pavitra

Updated on 23-Dec-2019 07:35:02

515 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a hexadecimal string, we need to convert it into its decimal equivalent.We have two approaches to solve the problem−Brute-force ApproachUsing Built-in moduleBrute-Force MethodHere we take the help of explicit type casting ... Read More

Convert a list to string in Python program

Pavitra

Pavitra

Updated on 23-Dec-2019 07:28:22

237 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a list iterable, we need to convert it into a string type iterable.There are four approaches to solve the given problem. Let’s see them one by one−Brute-force ApproachExample Live Demodef listToString(s):   ... Read More

Python program to check if the given string is vowel Palindrome

Pavitra

Pavitra

Updated on 23-Dec-2019 07:17:47

452 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given string (containing both vowel and consonant letters), remove all consonants, then check if the resulting string is a palindrome or not.Here we first remove all the consonants present in the string. ... Read More

Python program to check if a given string is Keyword or not

Pavitra

Pavitra

Updated on 23-Dec-2019 07:13:45

496 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number, we need to check that the number is a power of two or not.Keywords are the special words reserved by any language with specific usage and cannot be used ... Read More

Python Program for Number of elements with odd factors in the given range

Pavitra

Pavitra

Updated on 23-Dec-2019 07:03:27

567 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a range, we need to find the number of odd factors in the range.ApproachAs we all know that all perfect squares have an odd number of factors in a range. So ... Read More

Python Program for nth multiple of a number in Fibonacci Series

Pavitra

Pavitra

Updated on 23-Dec-2019 07:00:09

1K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement− We are given a number, we need to find the nth multiple of a number k in Fibonacci number.The solution to the problem is discussed below−Example Live Demo# find function def find(k, n):    f1 ... Read More

Python Program for Efficient program to print all prime factors of a given number

Pavitra

Pavitra

Updated on 23-Dec-2019 06:43:38

320 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number, we need to find all the prime factors of a given number.The efficient solution to the problem is discussed below −Example Live Demo# Python program to print prime factors import ... Read More

Python Program for Common Divisors of Two Numbers

Pavitra

Pavitra

Updated on 23-Dec-2019 06:40:33

511 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given two integers, we need to display the common divisors of two numbersHere we are computing the minimum of the two numbers we take as input. A loop to calculate the ... Read More

Python Program to print all permutations of a given string

Pavitra

Pavitra

Updated on 20-Dec-2019 07:34:07

607 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a string we need to display all the possible permutations of the string.Now let’s observe the solution in the implementation below −Example Live Demo# conversion def toString(List):    return ''.join(List) # ... Read More

Advertisements