1+ # Install pip from here: https://pip.pypa.io/en/stable/installing/
2+ # pip is a package manager. if you want to install library in Python, just run pip install <name-of-library>
3+ # and you need to go to your cmd or terminal to run this pip install <name-of-library>
4+
5+ # Eg: You want to install Numpy library.
6+ # Go to cmd (Windows) or Terminal(Mac, Ubuntu)
7+ # Type: "python" or "python3" without the double quotes.
8+ # Then press Enter.
9+ # If you get something like this -- Python 3.7.0 (v3.....)
10+ # Then it means your Python is on Path and now you're ready to run pip.
11+
12+ # Type: "pip install numpy"
13+ # It'll start downloading and then install automatically.
14+
15+ # Install numpy from here: https://pypi.org/project/numpy/
16+
117# This program will take input from User and tell whether it's Prime or Not.
218
3- import numpy as np # numpy is a mathematical library which does fast computation
19+
20+ import numpy as np # numpy is a mathematical library which does fast computation
21+
22+ # "as" is used to give a short name to library.
23+ # you can write numpy as p, or numpy as num also. But accepted convention is np
424
525print ('''
626Hey! Enter a number and I'll tell you if it's prime or not.
1030
1131if num >= 2 :
1232 divisors_list = []
13- for divisor in range (2 , num ):
33+ for divisor in range (2 , num ):
1434 # if num % divisor == 0: # you can even use this commented 'if' statement.
15- if np .remainder (num , divisor ) == 0 : # this makes calculation faster
35+ if np .remainder (num , divisor ) == 0 : # this makes calculation faster
1636 divisors_list .append (divisor )
1737
1838 if len (divisors_list ) == 0 :
3151If the list is empty, number is prime.
3252If the list has elements, the number is not prime.
3353If user inputs any number less than 2, it says please enter a number greater than 1.
34- '''
54+ '''
0 commit comments