On 27/01/20 4:15 AM, ferzan saglam wrote:
Hello people, I have written the code below which works fine, but it has one 
small problem. Instead of printing one (x) on the first line, it prints two.
I have tried everything in my knowledge, but cannot fix the problem.
Thanks for any help in advance.
for x in range ( 0, 10):                                                        
        
   stars = 'x'                                                          
   count = 0                                                            
while count < x:                                                             
   stars = stars + 'x'                                                          
   count = count + 1                                                            
   print (stars)

These loops are serial, ie one after the other, and not "nested" (one 'inside' the other) - or the email messed-up the indentation.

However, why "nest" or have more than one loop, in any case?

>>> for i in range( 0, 10 ):
...     print( "*"*i )
...

*
**
***
****
*****
******
*******
********
*********
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to