Unable to evaluate if not for python -


i'm writing program python , i'm new python. i'm stuck problem need achieve 'if not' condition after validation on input data. please guide me i'm doing wrong , how can fix this.

thanks,

code

    if(options == 1):     print"please enter degrees fahrenheit:"     val1 = input('')     val2 = str(val1)     commaexist = any([st in ',' st in val2])        if not commaexist:        print"1"        elif:        print"2" elif(options == 2):     print"2p" elif(options == 3):     print"3p" else:     print"invalid" 

can please guide me best approach use input() instead raw_input ? need validate input numbers decimal point , minus sign other input invalid. approach use any() ? or python give other methods too.

why not use:

if "," not in val2:     print ("1") else:     print ("2") 

btw, print statements without parenthesis not work in python 3, python 2. believe parens works in both versions.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -