Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
prime_nonprime_count.py
def isPrime(n): p=1 if n==1: p=0 else: for i in range(2,n): if n%i==0: p=0 if p==1: return True else: return False def count(lst): prime=0 nprime=0 for e in lst: if isPrime(e): prime+=1 else: nprime+=1 return prime,nprime p,np=count([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]) print('prime_count {} and non prime_count {}'.format(p,np))
run
|
edit
|
history
|
help
0
BasicFunctions.py
5
intresting pattern
Ej2_PYTHON_203700377.
Return nth fibonacci number using memoization
check the browser existence one by one
Lab_III_3_24_11_2020
Insertion sort
Game2
Assignment-3b