How can I write down something in the if statement without losing the real semantic of it?


#1



How can I write down those variable inside of the if statement?
I can't just put it there, right?


pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha(); word=original.lower(); first="word"[0]:
    print original
else:
    print 'empty'


#2

Python does things in indents. And semicolons aren't really used in Python either (that's more of a javascript thing). So whatever you need to do in the if statement should be indented beneath it such as:

if 3 < 4 and 5 > 3:
    foo = random_word.lower()
    print foo
else:
    ...

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.