[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nested Loop Code Help

On 1/26/20 6:11 PM, Greg Ewing wrote:
> On 27/01/20 4:15 am, ferzan saglam wrote:
>> for x in range ( 0, 10):
>> ?? stars = 'x'
>> ?? count = 0
> By the way, this 'for' loop is unnecessary. The end result is just to
> give initial values to three names. You don't need a loop at all for
> that, just three assignment statements.
His thinking MIGHT have been that this for loop be the main loop that 
prints the 10 lines (i.e the following loop be within this loop). In 
that case, the assignment statements in the loop make sense. In that 
case, the print call wouldn't be in the while loop, which would add x 
'x's to the string.

Richard Damon