Loading...
The Inverted Triangle
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- junior, mid
Problem
Write a function that prints an inverted triangle pattern of asterisks. Given an integer n representing the number of rows, the first row has n asterisks, the second has n-1, and so on until the last row has 1. Return the output as a list of strings (one string per row).
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.