
Dylan L. answered 09/04/21
Python Programmer and Tutor
Instead of giving you the answer, I'm going to exam the problem and give some advise which I hope will help you with similar problems in the future.
- We have input in the form of a number
- The input is equal to the number of lines.
- for every subsequent line, one additional star is added
Usually when we have a problem that involves repeating something X number of times, the easiest solution is to use a for-loop. Specifically a "for n in range(X)" loop. So if X = 5, then you would end up with "for n in range(5)".
One thing to keep in mind, though, is that the input() function produces strings. Strings aren't treated like actual numbers in programming. Therefor you must first convert this input into a usable number. You can do this using the int() function.