I\'m a beginning programmer in python and have a question about my code I\'m writing:
number = int(input(\"Enter a random number: \")) for num in range(1, n
the trouble is in your else: statement which has to run outside of the first loop. I recommend the following:
def isprime(num): for i in range(2, num): if (num % i) == 0: return False return True for num in range(1, number + 1) : if isprime(num): print num