Strip quotes and spaces from a variable

Question:

I want to create a variable [Word] that contains a word from a list of letters but does not include any brackets, spaces or commas.

Here’s where i have gotten to:

Letters = ["u", "i", "p","a","o","g", "h","j","k","l","z","x","v","b"]

FirstLetter = -1
SecondLetter = 'o'
ThirdLetter = 'a'
FourthLetter = 'l'
Endletter = 0
while FirstLetter < 13:
    FirstLetter = FirstLetter +1
    Word = (Letters[FirstLetter], SecondLetter,ThirdLetter,FourthLetter,Letters[Endletter])
    print(Word)

The output of the first line is:

('u', 'o', 'a', 'l', 'u')

I want:

uoalu

Sorry if this is already answered I’ve tried a heap of suggestions on here but cant get it

Asked By: DiscoPy

||

Answers:

If you want to join a string of characters into a single string, you should use join().

Word = "".join((
   Letters[FirstLetter], 
   SecondLetter,
   ThirdLetter,
   FourthLetter,
   Letters[Endletter],
 ))
Answered By: Oddthinking
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.