Advertisement
surya_adi

prime.py

Dec 4th, 2020
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #!usr/bin/env python3
  2.  
  3. """
  4. prime or composite
  5. """
  6.  
  7. from random import randint
  8.  
  9. num = randint(0, 100)
  10. div = [2, 3, 5, 7]
  11.  
  12. def pri(init):
  13.     """divider"""
  14.     for i in div:
  15.         if init % i == 0:
  16.             return 1
  17.             break
  18.  
  19. if pri(num) is None:
  20.     print("%s is prime number" % num)
  21. else:
  22.     print("%s is composite number" % num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement