Python word length -


is there way can set variables.

l1, l2, l3, l4, l5, l6, l7, l8, l9, = (' ',)*9 word = input("choose 9 letter word: ") wordlist = list(word) wordl = len(word) l1, l2, l3, l4, l5, l6, l7, l8, l9, = (wordlist) 

more there way if enters 6 letter word set l6 , leave l7-l9 blank?

you should use list. if l list (so have l[0], l[1], ..., l[9] = ...), want:

for (index, letter) in enumerate(word):   l[index] = letter 

(i assume have reason want leave later variables unassigned. if want them blank simpler string padding method better)


Comments