Why is it not printing the updated word?

Question

Why is it not printing the updated word?

Answer

If you’re still printing the original variable, then you should expect to see the original input string printed to the console. To see the string we’ve made some changes to by now, we need to print the variable we want to see displayed to the screen. For example:

first_string = “My initial STRING!”
new_string = first_string.lower() + “ Altered!”
print first_string

In the code above, we made a string, changed it, but are still printing the first string we made. To see the changed string, we’d print new_string.

1 Like

I think there is a bug here, I copy and paste the solution after reseting the lesson and yet it is still showing error/incorrect syntax

2 Likes

Please post a link to this exercise so we can have a look.

Experiencing the same thing for some reason.

https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/move-it-on-back

1 Like

same here, it is basically impossible!

1 Like

the reason why it isnt working is because you need to actually type "print " and the variable to allow it to show the word in its updated form.

1 Like

https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/move-it-on-back

I have typed print, it’s still not working

https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/move-it-on-back
yep this is still not working can someone tell what i can do to fix it?

1 Like

“Traceback (most recent call last):
File “python”, line 3, in
ExecTimeoutException: Program took too long to terminate.”
This is what I have been getting while working in this entire section of PYGLATIN

11 Likes

If the program will not accept inputs in the console, then bypass the prompt (comment it out) and assign a literal string to the variable. Then run the program with that.

1 Like

Which of the variables to be specific? And I can’t seem to to get any result on the console prompt if I enter a word, which I’ve tried severally in capital letters. I use google chrome.

Any that are associated with prompt() statements. Just write in their values and run the program.

Checked it a few times. it seems to bug on the .lower
That leads to
–>Traceback (most recent call last):
File “python”, line 7, in
TypeError: unsupported operand type(s) for +: ‘builtin_function_or_method’ and ‘unicode’

found out there was just a syntax error at my side. in the .lower

Okay, just copy and paste this.

pyg = ‘ay’;
original = ‘string’;

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

pyg = ‘ay’;
original = ‘string’;

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

For me I was stuck for a bit because every time I would run it it would print the word i did before and not the current one that I just entered. So I fixed it by moving the print to below the rest of the indented code like this (I just put this here for others i case they have the same problem):

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

print new_word

else:

print 'empty'