Category: programs in python
Python | Reverse a string without recursion
Let us now see all the methods to solve Python programs to reverse a string without recursion. Method 1: Using the loop Output Explanation We…
Python | Reverse a list using recursion
Explanation: Here in this approach, we first took the input from the user about the number of elements in the list, and based on that…
Python | Print Hello world using function
Today in this article, we will talk about how to print “Hello World”, but the only catch is that we will not use the simple…
Python | Reverse a list without recursion
Let us take a look at how to solve this problem with various different methods. Method 1: Using reduce() of functools method Output: Explanation: At…
Python | Check if a string is a palindrome or not using Recursion
Method 1: Using the string slicing method with the recursive approach Output: Explanation Now if the length of the string is less than 1 then…
Python | Find n-th Fibonacci number without recursion
Let us take a look at all the ways using which we can solve this problem. Method 1: Using simple addition Output: Explanation:Here for 0…
Python | Factorial of a number using Recursion
Using the concept of recursion, we have two methods to solve this problem. Let us take a look at that method. Method 1: Using factorial…
Python | Factorial of a number without Recursion
Method 1: Using the numpy library Output: Explanation: We simply used the prod() function of the numpy library, wherein we used a for loop that…
Python Program to Find Sum of Digit of a Number using Recursion
Method 1: Using the divide method Output: Explanation: Here we will be using conditional for checking that if the number is 0 then its sum…
Python Program for the n-th Fibonacci number using recursion
Using recursion we have one way to solve this problem, let us take a look at it. Method 1: Using multiple conditionals Output: Explanation: This…