Use pass for an empty block

#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in 
#Python by Madhavan Mukund, Chennai Mathematical Institute 

while(True):  
  try:
    userdata = input("Enter a number: ")
    usernum = int(userdata)
  except ValueError:
    print("Not a number. Try again")
  except NameError:
    pass
  else:
    break  

Check wheather a number is composite or not

#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in 
#Python by Madhavan Mukund, Chennai Mathematical Institute 
 
def composite(n):
      for i in range(2,n):
        if n%i == 0:
          return(True)
      return(False)

Divison with multiple conditions

#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in 
#Python by Madhavan Mukund, Chennai Mathematical Institute 


def divides(m,n):
  if n%m == 0:
    return(True)
  else:
    return(False)


def even(n):
  return(divides(2,n))


def odd(n):
  return(not divides(2,n))

GCD using euclids algorithms & looping

# Credits to NPTEL MOOC,Programming, Data Structures & Algorithms 
#in Python by Madhavan Mukund, Chennai Mathematical Institute

def gcd(m,n):
  if m < n:  # Assume m >= n
    (m,n) = (n,m)
  while (m%n) != 0:
    diff = m-n
    # diff > n? Possible!
    (m,n) = (max(n,diff),min(n,diff))
  return(n)

Greatest common divisor program using euclids algorithms

#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in 
#Python by Madhavan Mukund, Chennai Mathematical Institute 
 
def gcd(m,n):
    if m < n:
        (m,n) = (n,m)
    if (m%n) == 0:
        return(n)
    else:
        diff = m-n
        return(gcd(max(n,diff),min(n,diff)))

print(gcd(12,3))