18 lines
492 B
Python
18 lines
492 B
Python
def table(c1, c2, c3):
|
|
t = "{:^10}|{:^10}|{:^10}|\n".format(c1[0],c2[0],c3[0])
|
|
t += ("-"*len(t)+"\n")
|
|
for n in range(1, len(c1)):
|
|
t += ("{:^10}|{:^10}|{:^10}|\n".format(c1[n],c2[n],c3[n]))
|
|
return(t)
|
|
def main():
|
|
n_list = ["x"]
|
|
sq_list = ["x²"]
|
|
cube_list = ["x³"]
|
|
for n in range(11):
|
|
n_list.append(n)
|
|
sq_list.append(n**2)
|
|
cube_list.append(n**3)
|
|
print(table(n_list, sq_list, cube_list))
|
|
|
|
if __name__ == "__main__":
|
|
main() |