In this, i've make use of slicing with format to adjust whitespace between number i.e., ". Iterative Calculation starting from index 1 Set limit of table, to which extent we wish to calculate table for desired number lim = int(raw_input("Enter limit of table")) Taking input from user as an integer num = int(raw_input("Enter your number")) I = ))+1) for j in i]Ĭreating Arithmetic table is much simpler but i thought i should post my answer despite the fact there are so many answers to this question because no one talked about limit of table. max_width = len(str(m)) + 1Īnd demonstrate the elasticity of the spacing with a different size, e.g. Using the default argument of ' ' for the fillchar. Of one larger than the largest integer in the list of lists (the last integer), We should convert them into strings that are right justified with a width Now that we have a list of list of integers that is in the form that we want, Cute (&free) multiplication charts (1-15) found in this post Multiplication is not essential only at school but in everyday life. M = list(list(range(1*i,(n+1)*i, i)) for i in range(1,n+1)) Here you can find free printable multiplication chart designs and times tables for multiplication grids 1 to 15 both black & white and in different color designs. I went for the approach of constructing a list of list of integers first, using the range function and taking advantage of the step argument.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |