• API
• FAQ
• Tools
• Archive
daily pastebin goal
65%
SHARE
TWEET

# Daftar bilangan prima dalam suatu range

a guest Dec 16th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def check_prime(angka):
2.     pembagi = list(range(1,angka+1))
3.     mod = []
4.
5.     for num in pembagi:
6.         if angka%num == 0:
7.             mod.append("tidak bersisa")
8.         else:
9.             mod.append("bersisa")
10.
11.     return mod
12.
13. def print_prime(awal,akhir):
14.
15.     primeList = []
16.
17.     for num in list(range(awal,akhir+1)):
18.         mod = check_prime(num)
19.         if "tidak bersisa" in mod[1:-1]:
20.             continue
21.         elif num == 1:
22.             continue
23.         else:
24.             primeList.append(num)
25.
26.     return primeList
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top