Create a new variable with if statement


#1

Hi!

I am stuck on section 8 of pygLatin Part 2 p any suggestion on how create a new variable within an if statement?


#2

Just put code that creates new variable in body of if :slightly_smiling: Example:

if not 18 % 2:
    result = "18 is odd!"

#3

Thanks for the input but for some reason its still not working


#4

Please post your code :slightly_smiling:


#5

pyg = 'ay'

original = raw_input('Enter a word:')

if

"word" = orginal.lower()

first = "word"[0]:

print original

else:
print 'empty'

I have to create a variable called word that is the lowercase of original and create a variable called first


#6

"word" is a string, value. word is a name of the object.

So to create object called word you should use this syntax:

word = orginal.lower()

And it's original, not orginal.

Whole code:

pyg = 'ay'

original = raw_input('Enter a word:')

if "you need to add a condition here":
    word = original.lower()
    first = word[0]
    print original
else:
    print 'empty'

#7

Thanks for the help and explanation!


#8

You're very welcome :slightly_smiling: