-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3_19.py
More file actions
35 lines (21 loc) · 625 Bytes
/
3_19.py
File metadata and controls
35 lines (21 loc) · 625 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
19. Write a program that draws “modular rectangles” like the ones below. The user specifies the
width and height of the rectangle, and the entries start at 0 and increase typewriter fashion
from left to right and top to bottom, but are all done mod 10. Below are examples of a 3 × 5
rectangle and a 4 × 8.
0 1 2 3 4
5 6 7 8 9
0 1 2 3 4
0 1 2 3 4 5 6 7
8 9 0 1 2 3 4 5
6 7 8 9 0 1 2 3
4 5 6 7 8 9 0 1
"""
number = -1
width = eval(input('Enter width:'))
height = eval(input('Enter height:'))
for i in range(height):
for j in range(width):
number += 1
print(number%10,' ',end='')
print()