<jupyter_start><jupyter_text>Question 1Write a python Function for finding is a given number prime or not and do Unit Testing on it usingPyLint and Unittest Library.<jupyter_code>! pip install pylint
%%writefile primecheck.py
'''
It is a prime number checking program file
'''
def primeornot(num):
    '''
    This function checks whether given number is prime or not
    '''
    if num in (0, 1):
        return "Invalid Number"
    for i in range(2, num):
        if num%i == 0:
            return "It is not a Prime Number"
    return "It is a Prime Number"
! pylint "primecheck.py"
import primecheck
primecheck.primeornot(17)
%%writefile testPrime.py

import unittest
import primecheck

class testPrime(unittest.TestCase):
    def testnumberprime(self):
        x = 17
        result = primecheck.primeornot(x)
        self.assertEquals(result, "It is a Prime Number")

if __name__ == "__main__":
    unittest.main()
! python testPrime.py<jupyter_output>testPrime.py:9: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(result, "It is a Prime Number")
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
{'fraction_non_alphanumeric': 0.14212765957446807, 'fraction_numerical': 0.01276595744680851, 'mean_word_length': 2.757188498402556, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '570596', 'license': 'Apache-2.0', 'n_tokens_mistral': 357, 'n_tokens_neox': 340, 'n_words': 126, 'path': 'Day 9/Assignment Day 9 Question 1.ipynb', 'repo_name': 'Mukund-Joshi/LetsUpgrade-Python', 'size': '1175'}