python - How to put a blank space in a list? -



python - How to put a blank space in a list? -

example, want create list:

a = [1, 2, 3, , 5]

how set in blank space in between 3 , 5? want create game of hangman it, , blank space filled in player. list contain hangman question player need solve.

you can't leave "empty space" in list; each index has contain something. in general, "empty" index indicated sentinel value, none.

for game hangman, have own empty space character, e.g. underscore "_":

word = ["h", "e", "_", "_", "o"]

this allows print word, showing user blanks are:

>>> print " ".join(word) h e _ _ o

python

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -