brewersfan1976

ch2-ex3.py

Jul 3rd, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. column1 = "number"
  2. column2 = "squared"
  3. column3 = "cubed"
  4.  
  5. print column1.rjust(20), column2.rjust(20), column3.rjust(20)
  6.  
  7. column1 = "------"
  8. column2 = "-------"
  9. column3 = "-----"
  10.  
  11. print column1.rjust(20), column2.rjust(20), column3.rjust(20)
  12. print " "
  13.  
  14. x = 1
  15. y = 0
  16. z = 0
  17.  
  18. while (x <= 10):
  19.    y = x * x
  20.    z = x * x * x
  21.    print str(x).rjust(20), str(y).rjust(20), str(z).rjust(20)
  22.    x = x + 2
Advertisement
Add Comment
Please, Sign In to add comment