You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Python3.7, entering this function and passing the number 5 to the function results in multiple return values of "True". What's causing that?
defis_prime(num):
''' Naive method of checking for primes. '''forninrange(2,num):
ifnum%n==0:
print'not prime'breakelse: # If never mod zero, then primeprint'prime'
>>>is_prime(5)
primeprimeprime
The text was updated successfully, but these errors were encountered:
this can only happen if while originally testing your function looked like
defis_prime(num):
''' Naive method of checking for primes. '''forninrange(2,num):
ifnum%n==0:
print'not prime'breakelse: # If never mod zero, then primeprint'prime'
instead of
defis_prime(num):
''' Naive method of checking for primes. '''forninrange(2,num):
ifnum%n==0:
print'not prime'breakelse: # If never mod zero, then primeprint'prime'
In Python3.7, entering this function and passing the number 5 to the function results in multiple return values of "True". What's causing that?
The text was updated successfully, but these errors were encountered: