Op 27-11-11 20:02, Hugo Arts schreef:
On Sun, Nov 27, 2011 at 7:52 PM, surya ksur...@live.com wrote:
Hi,
Could you please tell me why this isn't working and how can I make it
possible...
Consider this code..
name = raw_input(Enter your first name: )
if name[0] == (m or f or b) :
rhyme =
surya k wrote:
Could you please tell me why this isn't working and how can I make it
possible... Consider this code..
name = raw_input(Enter your first name:)
if name[0] == (m or f or b) :
rhyme = name[1:]
What I want here is.. If the name starts with 'm' or
'f' or 'b', The
Timo wrote:
if name[0] in (m, f, b):
Or even shorter:
if name[0] in mfb:
Shorter, but wrong.
name = ['fb', 'ph', 'xy'] # oops, bad data
if name[0] in 'mfb':
...
Bad data should lead to an error as close as possible to the source of the bad
data, and do the wrong thing for a while
Hi,
Could you please tell me why this isn't working and how can I make it
possible...
Consider this code..name = raw_input(Enter your first name: )
if name[0] == (m or f or b) :
rhyme = name[1:]What I want here is.. If the name starts with 'm' or 'f' or
'b', The first letter should be
On Sun, Nov 27, 2011 at 7:52 PM, surya k sur...@live.com wrote:
Hi,
Could you please tell me why this isn't working and how can I make it
possible...
Consider this code..
name = raw_input(Enter your first name: )
if name[0] == (m or f or b) :
rhyme = name[1:]
What I want here is.. If
On 11/27/2011 1:52 PM, surya k wrote:
Hi,
Could you please tell me why this isn't working and how can I make it
possible...
Consider this code..
name = raw_input(Enter your first name: )
if name[0] == (m or f or b) :
rhyme = name[1:]
What I want here is.. If the name starts
On 11/27/2011 1:52 PM, surya k wrote:
Hi,
Could you please tell me why this isn't working and how can I make it
possible...
Consider this code..
name = raw_input(Enter your first name: )
if name[0] == (m or f or b) :
rhyme = name[1:]
What I want here is.. If the name starts
On 27/11/11 19:02, Hugo Arts wrote:
if name[0] == m or name[0] == f or name[0] == b:
or, more idiomatically, you can use the in operator like this:
if name[0] in (m, f, b):
And you might want to force it to lower case too:
if name[0].lower() in (m, f, b):
OTOH you might want it to be case