Integer to string length in python? -
i trying create function takes integer (n) , returns string n-amount of hashes.
ex:
if n 5, string : #####
if n 2 string : ##
here's such function:
def f(n): return '#' * n
usage:
>>> f(5) '#####' >>> f(2) '##'
Comments
Post a Comment