[Tutor] help
R. A.
griff@netdoor.com
Mon, 09 Oct 2000 22:04:52 -0500
Richard,
I'm really new at this, too, so someone else will probably provide a
better answer than mine. However, here goes:
# declare a variable named *animaltype*
animaltype = "feline"
# ask for input, assigning the input to the variable *input*
input = raw_input("what kind of animal is a cat?")
# if *input* is equivalent to *animaltype*, print *that's right*
if input == animaltype:
print "that's right!"
# otherwise, print *try again*
else:
print "try again"
There's a slightly more sophisticated example on one of my web pages, if
you care to glance at it:
http://www2.netdoor.com/~griff/magicword.html
Rob Andrews
> "Richard E. Doksa" wrote:
>
> hi im new to programming and cant find help anywhere where i live i
> was wondering can anyone tell me what is wrong with this program i
> wrote. it is only a program to answer a simple question.
>
> input = feline
> print raw_input("what kind of animal is a cat?")
> if input == feline:
> print "thats right!"
> if input != feline:
> print "try again"
>
> it somewhat works but isnt right what im i doing wrong?
>
> thanks
> rick~>
--
GIT/P/TW d---(++) s++:s a? C+++++ U$>+++ P+ L+>++++ E@ W++ N++ o? K- w$
?O ?M ?V PS+++ PE Y+@ PGP- t+@ 5 X@ R+ tv+ b+++ DI+@ D+ Q3A++ e++* h* r
y++* UF+++