python 2.7 - If statements and strings -


how can code respond string inputs? want if answer yes or no. tried this.

yes = 'yes' yesorno = input('yes or no?') if yesorno == yes:     print'you said yes' 

no matter typed input, say,'you said yes'.

in python 2 input doesn't return string, object. want

choice = raw_input('yes or no?\n') if choice == 'yes':     print 'you said yes' else:     print 'you said no' 

raw_input return string.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -