Monday, August 15, 2022

### Python program to find the LCM of two numbers using recursive

def lcm(a,b): lcm.multiple=lcm.multiple+b if((lcm.multiple % a == 0) and (lcm.multiple % b == 0)): ...

### Python program to check if a number is an armstrong number

n=int(input("Please enter any number: ")) a=list(map(int,str(n))) b=list(map(lambda x:x**3,a)) if(sum(b)==n): print("The number is an armstrong number ") else: print("The number is not an...

### Python program to reverse a string using recursive

def reverse(str):   if len(str) == 0: return str else: ...

### Python program to check if a substring is present in a given string

string=input("Please enter string: ") sub_string=input("Please enter substring: ") if(string.find(sub_string)==-1): print("Substring is not found in string") else: print("Substring is in string") Output 1: ...

### Python program to calculate the number of digits and letters in a string

string=input("Please enter string: ") c1=0 c2=0 for i in string: if(i.isdigit()): ...

### Python program to check whether a string is a palindrome or not

string=input("Please enter a string: ") if(string==string): print("Given string is palindrome") else: print("Given string is not palindrome") ...

### Python program to count the number of vowels in a string

string=input("Please enter string: ") vowels=0 for i in string: if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or =='I' or i=='O'...

### Python program to check whether a string is a palindrome or not using recursive

def is_palindrome(st): if len(st) < 1: return True else: ...

### Python program to check number is prime or not using recursive

def prime_or_not(n, div = None): if div is None: div = n - 1 ...

### Python program to find the factorial of a number using recursive

def recur_factorial(num): if(num <= 1): return 1 else: ...

### Python program to find the GCD of two numbers using recursive

def gcd(x,y):     if(y==0):       return x     else:       return gcd(y,x%y) x=int(input("Please enter first number: ")) y=int(input("Please enter second...

### Python program to check find the given year is a leap year or not

year=int(input("Please enter a year to be check leap year or not: ")) if(year%4==0 and year%100!=0 or year%400==0): print("This year is a leap...

### Python program to find the LCM of two numbers using recursive

def lcm(a,b): lcm.multiple=lcm.multiple+b if((lcm.multiple % a == 0) and (lcm.multiple % b == 0)): ...