Word Up trouble!


#1



Replace this line with your code.


#2

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    print original
else:
    print "Empty"
word = original.lower()
forst = word[0]

CAN SOMEONE PLEASE LET ME KNOW WHAT IS WRONG WITH MY CODE? THAT WOULD BE WONDERFUL THANKS!


#3

your variable is called forst, this should be first.

Also, please use the template in the question or the markup instructions i send you


#4

hello i am trying to get past this part
pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
else:
print "Empty"

word = "orginal"
word = original.lower()
first = word[0]
new_word = word + first + pyg
s = new_word

print s[1:len(s)]
it says that i am not making it a slice?
if anyone could help me move on i would appreciate it


#5

Hi sdalcala. :slight_smile:

I don't know really what are you trying to do with this code:

word = "orginal"
word = original.lower()
first = word[0]
new_word = word + first + pyg
s = new_word

because you are storing in variable word string "orginal" instead of variable original.


Here's my solution and explanation:
(I use sign """ for comments (explanation) in code.)

Original code:

pyg = 'ay'

original = raw_input('Enter a word:')

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

Code with explanation:

pyg = 'ay'

""" create new variable called original which take input from user """
original = raw_input('Enter a word:') 

""" check if users input is not empty and has letters instead of numbers """
if len(original) > 0 and original.isalpha():

""" create new variable word that holds the .lower()-case conversion of original variable """
    word = original.lower()

""" create a new variable called first that holds word[0], the first letter of word. """
    first = word [0]

""" print users input from original variable """
    print original
""" print lower()-case version of original variable """
    print word
""" print first letter of original variable """
    print first
else:
    print 'empty'

Example:

Input:

Result:


I hope this will help you. :slight_smile:


#6

That's code for word up section.
Here's code for ending up section:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word [0]
    new_word = word + first + pyg
    new_word = new_word[1:len(new_word)]
    print original
    print word
    print first
    print new_word
else:
    print 'empty'