Single underscores are allowed between digits and after any base specifier. Leading, trailing, or multiple underscores in a row are not allowed.
The string formatting language also now has support for the '_' option to signal the use of an underscore for a thousands separator for floating point presentation types and for integer presentation type 'd'. For integer presentation types 'b', 'o', 'x', and 'X', underscores will be inserted every 4 digits:
PEP 515 – Underscores in Numeric Literals
PEP written by Georg Brandl and Serhiy Storchaka.
Given a Numpy matrix a containing only integers, return a string representation of the element at the i-th row and j-th column. The string must use underscores as presented before (eg. 123456 must be converted into '123_456').
Literal String Example
def get_element(a, i, j):
el = a.item((i, j))
return el # TODO
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.