Python Forum

Full Version: Syntax error when using <> operator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Guys,

I am trying to run this code and each time I am getting an invalid syntax error message, I tried changing the variables, the file name, the program but it always give that error. When I change the operator to > , < or == it works!

Appreciate any help or suggestions.

Thanks :)

a=1
b=2

if a<>b:
    a=b
Hello! <> is it mean "is not equal to"? It is old syntaxis I think. Try !=
This is the second time I have seen this recently. Is there some awful tutorial that is still teaching this or something?
It was deprecated in Python 2, and I believe it was removed entirely in Python 3. In either case, you definitely shouldn't be using it.
(Dec-14-2016, 06:51 PM)Mekire Wrote: [ -> ]This is the second time I have seen this recently.  Is there some awful tutorial that is still teaching this or something?

I don't ask anymore. There is, obviously. But I wondering how people run across these!?   Think
That's definitely possible, but I think it's more likely they're coming from another language or are picking up programming again after having used it years ago.
Thanks guys, this worked.
@Mekire, the first result in google search for "not equal operator in python" https://www.tutorialspoint.com/python/py...rators.htm
THanks for looping back! tutorialspoint usually has good stuff, I'm going to try to contact them about that....
(Dec-14-2016, 07:00 PM)micseydel Wrote: [ -> ]THanks for looping back! tutorialspoint usually has good stuff, I'm going to try to contact them about that....

Yes! I have downloaded half the site. At least  Big Grin
https://www.tutorialspoint.com/python/index.htm

Quote:For most of the examples given in this tutorial you will find Try it option, so just make use of it and enjoy your learning.

Try following example using Try it option available at the top right corner of the below sample code box −

#!/usr/bin/python

print "Hello, Python!"

Probably all of their stuff is still 2.x