Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_number():
- give = int(input('Enter the number you want to check is prime or not : ')) # asking input andconverting it into integer since by default it will be string
- give1 = int(give/2) # we know a number greater than the half of that number won't be able to divide it
- # COnveriting into integer because the result will be float
- for i in range(1,give1):
- if give % i == 0:
- print('THe number {} is prime'.format(give))
- break # since there is now no pint in continuing the if loop
- else:
- print('The number {} is not prime {}'.format(give))
- check_number()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement