[Tutor] while x != 'n' or 'N' or 'l' or 'L':

Jose Alberto Abreu abreu@penguinpowered.com
Wed, 06 Dec 2000 00:23:04 -0600


Hello everybody! 
Im new to both Python and programming, so you can expect me to ask many
questions in this list! ; )

Well... I made a (very simple) test module named prime.py that basically
checks if a number is prime (duh!). The module works fine by itself, but
now I am trying to make another script that will either tell if a given
number is prime or which numbers from a list are primes.
I think theres a problem in the line that reads the same as the title of
this message, but I will include the whole script (sans the prime.py
module, which is in the same directory):

#!/usr/local/bin/python
# Testing the module prime.py
import prime
print "This is a test script"
x = ""
while x != 'n' or 'N' or 'l' or 'L':
	x = raw_input ("Type 'L' for a list of primes or 'N' to test a single
number: ")

if x == 'N' or 'n':
	numbr = int(raw_input ("Type a number: "))
	if prime.prime(numbr):
		print "Yeah, its a prime alright!"
	else:
		print "Nope, it aint no prime number"

else:
	y = int(raw_input ("Type a number: "))
	s=range(list)
	result = filter(prime.prime, s)
	print "The following numbers are primes: "
	print result


Of course this is very very basic, but Im a bit stumped, and I cant find
anything in my Python book (Teach Yourself Python in 24hrs, by Ivan Van
Laningham) to help me out.

-- 
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170
  Jose Alberto Abreu - abreu@penguinpowered.com   |   Futile is the
labor of those who fatigue
     Bag detective and apprentice codecaster      |   themselves with
calculations to square the
                                                  |   the
circle          - Michael Stifel (1544)
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170