I'm learning Python for 52 weeks of code, and this is going to be my submission. Sadly, it's not working. It's reading the input() as a string, which is STRANGE because I'm entering numbers. I'm using Python 3.0.1 so for some reason raw_input() doesn't work. Is there a way to force it to read input() as an int?
Code:
number = input('Enter a number, and I will print all prime numbers below it: ')
up = 5
while up <= number:
whileup = 2
isPrime = False
while whileup < number:
if number%whileup!=0:
whileup = whileup + 1
elif number%whileup==0:
break
elif whileup > (number/2):
isPrime = True
break
if isPrime == True:
print ("Prime Number: ", number)
isPrime = False
number = number + 1
Please excuse any obvious efficiency problems. This is my first Python code ever.

New Topic/Question
Reply


MultiQuote



|