Move it on Back


#1

I DON'T KNOW WHAT I AM DOING WRONG??

pyg = 'ay'

original = raw_input('Enter a word;')
word = original.lower()
first = word[0]

if len(original) > 0 and original.isalpha():
print original
else:
print 'empty'

new_word = word + first + pyg
# new_word = 'pythonpay'
new_word = new_word[1:len(new_word)]
print new_word
# --> new_word --> 'ythonpay'


#2

Ok, so my formatting of this code is a little different than yours. I will go through what I have for my basic outline for this lesson but someone else can come in an give an answer more specific to your style of coding if you want. First, everything except for your first two lines need to be under your if and else statement. Secondly, I am not sure what the # are in their for but they are not necessary unless you are just showing the result of the code. Thirdly, you have all the right information it would seem to complete the code it is just not set up correctly. So you just need to reorganize all this. If you have any more questions just let me know! :smiley: Hopefully this helps.

pyg = 'ay'

original = raw_input('Enter a word:')

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

#3

THANK YOU FOR HELPING, but it says i deleted my word variable. I AM REALLY CLUELESS!!! I'M SORRY!!!


#4

repost your code for me please


#5

this is my code: pyg = 'ay'

original = raw_input('Enter a word:')

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

new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
print new_word

and this is what they said is wrong:
File "python", line 13
new_word = word + first + pyg
^
IndentationError: unindent does not match any outer indentation level
then this is at the bottom of the page:
Oops, try again. Oops! Did you accidentally delete the word variable?


#6

Ok so an Indentation Error means that you have not correctly spaced your code. As we both know, Python is very specific in how their code is formatted. I would go back to the code I copied and pasted in my first response and use that exact spacing. I might should have made that more clear that the spacing should have been changed as well as the organization but I did not think about that at the time. So hopefully that will help. If you have any more questions I can help you respace it out and all or explain it if necessary :smiley:


#7

i went ahead and copied and pasted it, so i did the spacing correct. so please(sorry that i keep bothering you!!!) explain!


#8

No problem. Listen, this is tricky stuff xD I went from Java/Javascript to Python and it can get confusing. Plus, its no bother, that is why the Forums are here is to help people learn! Happy coding!


#9

THANK YOU!!!!! YOU ARE AWESOME!!!!! python is cofusing... but i hope one day i will be doing animations on youtube!!!!!


#10

Now that is a great goal and will be awesome to see! Let us know when you make it to the big time! :smiley:


#11

THANKS!! what are you gonna do when you finish python??? and how has java/javascript helped you with python?


#12

Well, honestly, I have nothing really "in mind", I am learning code to help open opportunities in the work place and to expand my knowledge to an industry like computers and coding that can only expand from here seemingly. So I just want to be prepared for anything that might come my way xD I think Java and Javascript just helped me get affiliated with good, solid coding build me a foundation to go off of and get me used to the site and put roots here. So while they may not be necessarily corresponding in their code types the different coding languages have helped me a lot in general.


#13

COOL!!! :grinning: :sunny: :slight_smile:


#14

so umm... whenever you have a chance, can you explain? i mean,i put in the code you said and it keeps saying the same thing. So, umm.. just when you have a chance.... :relaxed: :grinning::grin::smiley::laughing::relieved:


#15

Repost your code and let me know what it is saying xD


#16

code:
pyg = 'ay'

original = raw_input('Enter a word:')

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

new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
print new_word
the result thingy:
File "python", line 13
new_word = word + first + pyg
^
IndentationError: unindent does not match any outer indentation level
and what it says at da bottom:
Oops, try again. Oops! Did you accidentally delete the word variable?


#17

Are you on a new lesson or is this still move it on back? That will make a difference in what I answer lol


#18

i am still stuck!!!:cry::confounded::tired_face::disappointed::confused:


#19

Ok don't cry lol

You do not need this for your code. Now the spacing error.

You need to tab over everything after the if statement except the else statement. So for example:

if len(original) > 0 and original.isalpha():
    print original //indent the line for proper indention!

So eventually your spacing will look just like this:

if len(original) > 0 and original.isalpha():
    print original
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg //every line is indented
else:
    print 'empty' // even this one!

Your final code should look just like that. You have all the pieces its just not clicking. You are almost there!


#20

ok. I did put in their that spacing(command c, command v) and took out the stuff i didn't need, and it says i am still wrong!! I'm really sorry i keep bugging you about this!!!