Code did not run to end....Help!


#1


Hi guys,
Just started coding two weeks ago so forgive me for my messy code. Every time that I run this code it says:
Oops, try again. Your code did not run to end - see the console window for the error message.

So I re-read and followed the instructions, which are the following:
First we create a variable s and give it the string "Charlie"
Next we access the first letter of "Charlie" using s[0]. Remember letter positions start at 0.
Then we access a slice of "Charlie" using s[1:4]. This returns everything from the letter at position 1 up till position 4.
We are going to slice the string just like in the 3rd example above.

So now, I'm just confused. I'm not sure if I'm slicing the code right or where I'm supposed to put the code. It may not be in order or anything. I appreciate any and all help!


pyg = 'ay'
word = "original"
word = word.lower()
first = word [0]
new_word = word + first + pyg

s = "Charlie"

print s[0]

print s[1:4]

original = raw_input('Enter a word:')

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


Replace this line with your code.


#2

That's not instruction, Thats theory!
Instruction is here that You missed..

Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.

page : https://www.codecademy.com/en/courses/python-beginner-2W5v7/1/4

do reply if you get the issue solved or not!


#3

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