Q:

Python:Christmas Tree

I need to print a Christmas tree that looks like this:
  /\  
 /  \
/    \

Here is my code so far:
for count in range (0,20):
    variable1 = count-20
    variable2 = count*2

print('{0:{width1}}{1:{width2}}' .format('/','\\', width1=variable1 , width2=variable2))

I am using Python 3.5. And the coding says Sign not allowded in sstring format specifier

A:

The following works with Python 3.4, I would assume it also works with Python 3.5.
    for count in range (20):
        print('{0:>{width1}}{1:>{width2}}' .format('/','\\', width1=20-count , width2=2*count+1))

The import part is - as others have mentioned in comments - not to use fixed width for the formatting.
Please notice the neccessary '>' alignment character which is needed for right alignment.

