fork download
  1. # http://c...content-available-to-author-only...e.com/a/86558/34718
  2.  
  3. """
  4. 1 x 8 + 1 = 9
  5. 12 x 8 + 2 = 98
  6. 123 x 8 + 3 = 987
  7. 1234 x 8 + 4 = 9876
  8. 12345 x 8 + 5 = 98765
  9. 123456 x 8 + 6 = 987654
  10. 1234567 x 8 + 7 = 9876543
  11. 12345678 x 8 + 8 = 98765432
  12. 123456789 x 8 + 9 = 987654321
  13. """
  14.  
  15. #for n in range(1,10):print" "*(9-n)+`range(1,n+1)`[1::3]+" x 8 + %d = "%n+`range(9,9-n,-1)`[1::3]
  16.  
  17. s="123456789"
  18. n=1
  19. exec'print"%9s"%s[:n],"x 8 + %s ="%n,s[::-1][:n];n+=1;'*9
  20.  
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
        1 x 8 + 1 = 9
       12 x 8 + 2 = 98
      123 x 8 + 3 = 987
     1234 x 8 + 4 = 9876
    12345 x 8 + 5 = 98765
   123456 x 8 + 6 = 987654
  1234567 x 8 + 7 = 9876543
 12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321