python - How remove the Space from the bottom of the output? -


i trying following output?

* ** *** ** * 

here code in python

n = int(input(" please enter number: "))  j=1 while j<=n:     print('*'* j)     j+=1  while n>=1:     print('*'* (n-1))     n=n-1     #print(n) 

but problem gives me following output

* ** *** ** *  getting space after output. 

does know reason behind , remedy same.

you need

while n>=2: 

in last loop. otherwise further line 0 (1-1=0) stars plotted @ end


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -