project_python/2.3_lesson.3.20.py
2025-12-15 13:48:56 +05:00

20 lines
741 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

****Задание 3 Параграф 2.3***
**** Напишите программу, которая по введённому числу n строит «математическую ёлку» — пирамидку из чисел.
В первой строке одно число, во второй — два, в третьей — три... и так далее, пока не закончатся числа.****
if name == "main":
# Решение с вложенными циклами
dim = int(input())
count = 1
num = 1
while num <= dim:
for i in range(count):
if num > dim:
break
print(num, end=' ')
num += 1
print()
count += 1