subscript

Printing subscript in python

Printing subscript in python Question: In Python 3.3, is there any way to make a part of text in a string subscript when printed? e.g. Hâ‚‚ (H and then a subscript 2) Asked By: samrobbins || Source Answers: The output performed on the console is simple text. If the terminal supports unicode (most do nowadays) …

Total answers: 5

Python slice first and last element in list

Python slice first and last element in list Question: Is there a way to slice only the first and last item in a list? For example; If this is my list: >>> some_list [‘1’, ‘B’, ‘3’, ‘D’, ‘5’, ‘F’] I want to do this (obviously [0,-1] is not valid syntax): >>> first_item, last_item = some_list[0,-1] …

Total answers: 13