Page 261 - Computer Science Class 11 With Functions
P. 261
29 print(' ', end = '')
30 print()
31 hollowDiamond(11,'*')
Sample Output:
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Fig 10.11: Hollow Diamond
Partial Dry Run
i = 1
print 6-1=5 spaces
j = 1
print one *
print newline
i = 2
print 6-2=4 spaces
j = 1
print one *
j = 2
print one space
j = 3
print one *
print newline
i = 3
print 6-3=3 spaces
j = 1
print one *
j = 2
print one space
j = 3
print one space
j = 4
print one space
j = 5
print one *
print newline
and so on
10.8 Infinite Loop
A while loop becomes an infinite loop if the test condition never yields False. For example,
while True:
s = 1
print(s)
Looping in Python 259

