Task: Write a hangman game in Python.
Problem: You must select the first and last letters in the word.
Question: How to choose the first and last letter in a word in Python?

    2 answers 2

    first, last = word[0], word[-1] 

    arguments packing / unpacking

     # 'д' [] 'а' (first, *middle, last) = 'да' # 'с' ['л', 'о', 'в'] 'о' (first, *middle, last) = 'слово' # first="с", f="л", m="['о']", l="в", last="о" (first, *(f, *m, l), last) = 'слово' print('first="{first}", f="{f}", m="{m}", l="{l}", last="{last}"'.format(**vars()))