Write a program to compute the summation of first 10 natural numbers without using any built-in function.

def summmation(n):
  return n and n+ summmation(n-1)
summmation(10)
55

Write a program to calculate the factorial of a given number without using loops, built-in factorial functions, or external packages.

def factorial(n):
  return n>0 and n*factorial(n-1) or 1
factorial(5)
120

Write a program to reverse a given string without using any built-in string reversal function or external package.

“PYTHON” — “NOHTYP”

string="PYTHON"
strlen=len(string)
def reverse(string1,strleng):
  print(string1[strleng-1],end='')
  strleng>1 and reverse(string1,strleng-1)
reverse(string,strlen)
NOHTYP

Write a program to count the number of digits in a given integer without using any built-in function designed for counting digits.

Ex: Input: 12345, Output: 6

def count(num,count1):
  return num and count(num//10,count1+1) or count1
count(12345,0)
5