mardi 12 juillet 2016

how to print output in [w*h] format in python


I'm trying to program a code which accepts width , height and a char. print it in a grid [W*H] My code is as follows..

width = int(raw_input("Width of myarray: "))
height = int(raw_input("Height of Array: "))
c= raw_input("Initial char:  ")
a=(width*c), (height*c)
print a

output:

Width of myarray: 3
Height of Array: 3
Initial char:  +
+++++++++

I need the output in [['+', '+', '+'], ['+', '+', '+'], ['+', '+', '+']] this format.


Aucun commentaire:

Enregistrer un commentaire