Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Inverted_Pyramid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Inverted Pyramid

## Description

A small Python code that generates a inverted pyramid based on a positive number typed by the user.

## Installation

No external dependencies are used other than native Python language.

## Usage

Use the following command on the terminal:

```bash
python3 inverted_pyramid.py
```

## Technologies

- Python 3.12.1
10 changes: 10 additions & 0 deletions Inverted_Pyramid/inverted_pyramid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
height = int(input("Enter the height of the inverted pyramid: "))

while height <= 0:
print("Please enter a positive integer for the height.")
height = int(input("Enter the height of the inverted pyramid: "))

for i in range(height, 0, -1):
spaces = height - i
stars = 2 * i - 1
print(" " * spaces + "*" * stars)
Loading