Here are questions students raised about the Data Types worksheet, along with my answers: QUESTION 1 (Thu, 31 Jan 2008 15:51:36) ========== While trying one of the worksheet questions that required a numeric input i tried to make it a bit more generic by adding a few lines that would comment if what was entered wasn't a number. I tried the following but this won't do as it returns false for minus signs and decimal points. #!/usr/bin/python string = raw_input('enter text') if string.isdigit(): print 'ok' else: print 'not a number' Then i tried to just find negative numbers with this but i get syntax error on the 'and'. #!/usr/bin/python dat = raw_input('number please') # check if first char is - and rest are digits if dat[0]==- and dat[1:].isdigit(): print 'found negative number' else: print 'found something else' Is there any way, that i can do, to solve this and find if a string is any kind of number? Answer ------ Put the minus sign in quotes (you're checking for a minus sign character), i.e., dat[0]=='-'