8/11 badly stuck

pyg = 'ay'
word = "original"
word = word.lower()
original = raw_input('Enter a word:')

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

please tell me what i am doing wrong.:frowning:

The exercise says:

Inside your if statement:

Create a new variable called word that holds the .lower()-case conversion of original.Create a new variable called first that holds word[0], the first letter of word.

What you’ve done wrong is, creating the variable word outside the if statement, it must be inside. Secondly, it doesn’t say anywhere in the explanation to store a string the exercise says “create a new variable called word that holds the .lower() case conversion of the variable original”, delete the line with word = “original”.
Let me know if you need any further help!

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
word = original.lower()
first = “word”[0]
print word
print ‘empty’
First of all Thank you @xsorax
i further have question, when i am doing this i am going to the next exercise, i mean they say it is okay…

but first letter of the word is not printing, why is it so?

No need to thank me @systemace80996 :smile: we are all here to help each other out!
What you are doing wrong is storing in the variable first “word”[0], you are storing it as a string and it won’t work that way:
first = “word”[0]
Thats the source of your problem, I don’t want to give you the code straight as it could help you advancing and get better if you find the solution on your own, but remember Python treats as a string everything that’s inside the " " what you have to do is storing the variable word.
Let me know if it wasn’t clear enough!

Try this
original = raw_input(“Enter a Word:-”).lower()
if len(original) > 0 and original.isalpha():
word = original
first = word[0]
new_word = word + first + “py”
new_word = new_word[1:len(new_word)]

That’s totally wrong.
First of all the exercise is referring to the creation of the variable first not new_word, you are just simply confusing him that way, also new_word declaration is wrong, you’ve written:
new_word = word + first + “py” when it should be:
new_word = word + first + pyg

Also the variable original considering the exercise is wrong, you’ve stored .lower() in original instead of word.

yep this is 9th exercise. :smiley:

@systemace80996 How’s the exercise going? did you went through it? if you need anything dont hesitate to ask!

There is something with this exercise, it says start new lesson. I don’t understand.
first = word[0]
but it is not giving the desirable result.

Show me how your full code looks now @systemace80996 :grin:

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

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

print ‘empty’

yes i did
first i created a variable named original and i put the users input,
then i declared another variable named word, purpose to keep the copy of the value of original
then i declared another variable named first, purpose to keep first letter of my input
another variable new_word used for combining or concatenating all
then this variable is processed from which index to which index r 2 b printed

thats all it’s d logic

Your code is good now @systemace80996 you just missed print original inside the if statement :smile: add print original after first = word[0] and you’re good to go!

Also check the hint in the exercise:
Note: You can print out the values of the variables word and first to double-check your work (remove these print statements when you’re done debugging).

to check if everything is working as desired add print word and print first just remember to delete it before going to the next exercise!
Let me know if you need anything else :smile:

The purpose of the exercise is to create a variable word and add original.lower() there, not inside the variable original, which is not really wrong, but it doesn’t serve in the purpose of the exercise and it’s not written anywhere to store .lower() inside original it just confused the guy even more.

Also, where’s the variable pyg the exercise referred to? nowhere, when you were supposed to declare:
pyg = 'ay’
and then in your new_word variable you stored:
new_word = word + first + "py"
That’s wrong, it’s supposed to be:
new_word = word + first + pyg

Let’s respect the purposes of the exercise, otherwise there is no way people can learn as it only lead to more confusion especially to new people trying to learn from here.

ok i thought that lower the coding means quicker the process

It’s not really wrong, but IMHO respecting the exercise would be more educative, otherwise how do we learn?
It’s not really necessary to make processing quickier always but the opposite, following the exercise will help everybody learning more efficiently :smile:

Regarding the exercise itself, I hope my explanation were clear and that everything is working now, whether you guys need anything feel free to ask!

1 Like

done with 9 th exercise , thank you guys :stuck_out_tongue:

2 posts were split to a new topic: Coming up ‘empty’