-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintLevelExtra.py
More file actions
37 lines (32 loc) · 865 Bytes
/
printLevelExtra.py
File metadata and controls
37 lines (32 loc) · 865 Bytes
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
35
36
37
# 1
# 11
# 21
# 1211
# 111221
# 312211
# ...
# Based on the level sent in parameter of your function,
# you should print the number of rows resulting of this level.
# The sample above is LEVEL 6
#
# EXTRA : Now we have the right result, we want to print the LEVEL at the beginning of each line
# like this for the sample above :
#
# 1: 1
# 2: 11
# 3: 21
# 4: 1211
# 5: 111221
# 6: 312211
#
# CHALLENGE: YOU SHOULD NOT HAVE MORE THAN TWO CHANGES AGAINST YOUR PREVIOUS CODE
#
def printLevel(levelOfPrinting = 1):
line = '1'
print(f'1: {line}')
levelOfPrinting -= 1 # REDUCE the number of level to PRINT because we already print one above
# BEWARE the 'levelOfPrinting' has been reduced JUST BEFORE and it is not representing the entire number of lines !
# INSTRUCTION: COPY YOUR PREVIOUS CODE HERE
printLevel(6)
printLevel(8)
printLevel(12)