Difference between revisions of "CSC111 Exercises on nested for-loops"
(→Exercise 1) |
|||
Line 45: | Line 45: | ||
</source> | </source> | ||
<br /> | <br /> | ||
+ | <br /> | ||
+ | [[Category:Python]][[Category:CSC111]][[Category:Exercises]] |
Latest revision as of 21:06, 25 February 2014
--D. Thiebaut (talk) 10:32, 24 February 2014 (EST)
Exercise 1
This is taken from Section 4.7 in the textbook:
for i in range(4):
for j in range( i+1 ):
print( "*", end="" )
print()
The output is
*
**
***
****
- Question
- Modify the program so that it outputs this pattern
****
***
**
*
Exercise 2
Modify the program so that it outputs this pattern:
*
**
***
****