-
Notifications
You must be signed in to change notification settings - Fork 0
/
pascal_triangle_symbolic.py
34 lines (32 loc) · 1.05 KB
/
pascal_triangle_symbolic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
#-------------------------------------------------------------------------------
# Name: Pascal_triangle_symbolic.py
# Purpose: Exercise
# Writes Pascal's triangle.
#
# Author: E.M.
#
# Created: 23.03.2012
# Copyright: (c) [email protected] 2012
# Version 1.0
# Licence: GPL
#-------------------------------------------------------------------------------
#P\Informatica\GITHUB\PYTHON_LUNCH
__author__ = 'Emil'
char = sys.argv[1]
depth = int(sys.argv[2])
draw_line = ''
for k in range(1, depth):
draw_line = draw_line + ' ' # initialing the line with empty space
for i in range(0, depth):
draw_line = draw_line[1:] # deleting the first empty space of the line, [:1] means everything starting from the second element
draw_line = draw_line + ' ' + char #adding a new space between the last char of the line and the new added one
print (draw_line) #printing the line
''' *
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * * '''