Here are two ways to write a table of squares and cubes,squarescubes,for x in ran
Here are two ways to write a table of squares and cubes,squarescubes,for x in ran
for x in range(1, 11): print repr(x).rjust(2), repr(x*x).rjust(3), # Note trailing comma on previous line print repr(x*x*x).rjust(4)for x in range(1,11): print '%2d %3d %4d' % (x, x*x, x*x*x)
相关内容
- Log print message into a file,logmessage,import syspr
- Use list as a stack: push onto stack,stackonto,L = []L.appe
- Zip three tuples,zipthreetuples,T1, T2, T3 =
- in a range,inrange,from math im
- apply function,apply,def func(x,
- keeps '\' (Back splash) literally,splashliterally,x
- Specifying exception type,,# try: nu
- Use mouse to draw a shape on canvas,shapecanvas,from Tkinter
- Content tests: isalpha, isdigit, etc,isalphaisdigit,S = 'spam' S
- Use raw input to read int value,rawinput,import sys,
评论关闭