7) Write a code to generate an inverted half pyramid pattern using stars.
Input Description:
Given an integer R indicates number of rows.
Where 1<=R<=100.
Output Description:
Print the star inverted pyramid with the given integer R.
Sample Input :
5
Sample Output :
* * * * *
* * * *
* * *
* *
*
My Code:
n = int(input())
for i in range (n,0,-1):
for j in range(0,i):
print("*", end =" ")
print()
The output is the same but the test cases are failing. The same issue is with other pattern problems (prob 1) where space is involved (end = " "). Any reason for this? Please guide!