Logic To Check If Input Is Prime Number In Python