TDT4109/Exercise 3/11 - Doble lokker/task11b.py

20 lines
474 B
Python
Raw Normal View History

2020-09-23 11:09:25 +02:00
try:
from common.inputChecking.typeCheck import inputTypeCheck
except ModuleNotFoundError:
print('Sjekk README.md for hvilke flagg python trenger')
exit(1)
2020-09-14 16:36:27 +02:00
def numberPyramid(length):
for i in range(length):
print('X', ' ' * i + 'X')
def numberPyramidDoubleLoop(length):
for i in range(length):
space = ''.join([' ' for _ in range(i)])
print('X', space + 'X')
if __name__ == "__main__":
2020-09-23 11:09:25 +02:00
n = inputTypeCheck('n: ', int)
2020-09-14 16:36:27 +02:00
numberPyramidDoubleLoop(n)