[Tutor] Else command

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Aug 7 00:52:27 CEST 2004

> What command would I use and in what order to make it respond to
> but what I defined a certain variable as? For example I tell it that
> "Hello" and then I want it so it says "what?" for everything else

if not hi == "hello":
   print 'what?'

Is that what you mean?

An alternative way is to use the not-equal operator:

if hi != "hello":
   print "what?"


Alan G
Author of the Learn to Program web tutor

More information about the Tutor mailing list