Skip to main content

mo_ak

User since Oct 28, 2022
1 Posts
Python

Recent Posts

primes numbers finder

0 likes • Mar 12, 2021 • 0 views
Python
prime_lists=[] # a list to store the prime numbers
def prime(n): # define prime numbers
if n <= 1:
return False
# divide n by 2... up to n-1
for i in range(2, n):
if n % i == 0: # the remainder should'nt be a 0
return False
else:
prime_lists.append(n)
return True
for n in range(30,1000): # calling function and passing starting point =30 coz we need primes >30
prime(n)
check=0 # a var to limit the output to 10 only
for n in prime_lists:
for x in prime_lists:
val= n *x
if (val > 1000 ):
check=check +1
if (check <10) :
print("the num is:", val , "=",n , "* ", x )
break

Post Statistics

Posts

No Posts Found

It looks like mo_ak hasn't uploaded a post yet

Likes

Please Log In

You must be authenticated to view a user's likes

Shared

Please Log In

You must be authenticated to view a user's shared posts

Profile Privacy

Multi-Factor Authentication

Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.

Change Password

Forgot Password?

Identity Color

Changes the color of your profile icon and cursor highlight in the live code editor. You and other users will be able to view this change.

Delete Account

Deleting your account is permanent. All data associated with your account will be lost.