Python word length
<p>Is there a way that I can set only some variables.</p>

<pre><code>l1, l2, l3, l4, l5, l6, l7, l8, l9, = (' ',)*9
word = input("Choose up to a 9 letter word: ")
wordlist = list(word)
wordl = len(word)
l1, l2, l3, l4, l5, l6, l7, l8, l9, = (wordlist)
</code></pre>

<p>More specifically is there a way that if someone enters a 6 letter word that it will only set up l6 and leave l7-l9 blank? </p>

<p>You really should use a list. If <code>l</code> were a list (so you have <code>l[0], l[1], ..., l[9] = ...</code>), this does what you want:</p>

<pre><code>for (index, letter) in enumerate(word):
  l[index] = letter
</code></pre>

<p>(I assume you have some reason to want to leave later variables unassigned. if you just want them blank a simpler string padding method is better) </p>

python python-3.x