Where in my code do I make this new slice of new_word?


#1

Question

Where in my code do I make this new slice of new_word?

Answer

A common issue here is trying to replace what we already had for new_word, where we concatenated word, first, and pyg. For this exercise we should change new_word again, but by assigning a value over it using the existing version of itself. Take a look at the example below for a better idea:

my_word = first + middle + suffix
my_word = my_word[index_to_slice_goes_here]

Otherwise, we’d be writing new_word = new_word[...] without having defined new_word yet, which will give you an error that reads: NameError: ‘new_word’ is not defined because we’re trying to use it to define itself, which is invalid.


FAQ: Learn Python - Pyglatin - Ending Up
#2

2 posts were split to a new topic: This Code Seems Counter-Intuitive


#3

in the terminal for Pyglatin
i type Love
and it shows velay
how it’s executed