Ad
Strings
Data Types
Code
Diff
  • def f(n):
        l = [digit for digit in str(n)]
        
        count_to_three = 1
        for i in range(len(l) - 1, 0, -1):
            if count_to_three != 3:
                count_to_three += 1
            else:
                l.insert(i, ',')
                count_to_three = 1
                
        return ''.join(l) 
     
        if count_to_three<=1: 
            fotmat(len(l))
        
    • def f(n):
    • l = [digit for digit in str(n)]
    • count_to_three = 1
    • for i in range(len(l) - 1, 0, -1):
    • if count_to_three != 3:
    • count_to_three += 1
    • else:
    • l.insert(i, ',')
    • count_to_three = 1
    • return ''.join(l)
    • return ''.join(l)
    • if count_to_three<=1:
    • fotmat(len(l))