Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_prime(num):
- count = 0
- for i in range(1, num + 1):
- if not num % i:
- count += 1
- if num == 1:
- print(f'number {num} is Prime')
- elif num > 1 and count == 2:
- print(f'number {num} is Prime')
- else:
- print(f'number {num} is nonPrime')
- number = None
- while number != 'end':
- number = int(input())
- check_prime(number)
- ###########################################
- def check_prime(num):
- count = 0
- # global i
- ch_p = False
- for i in range(1, num + 1):
- if not num % i:
- count += 1
- if num == 1:
- ch_p = True
- elif num > 1 and count == 2:
- ch_p = True
- else:
- ch_p = False
- return ch_p
- number = None
- while number != 'end':
- number = int(input())
- for i in range(1, number + 1):
- number = str(number)
- if len(number) == 1:
- number = int(number)
- check_prime(number)
- else:
- number = int(number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement