# Week 4: Exercise Solutions

## Exercise 4.1

The first version of the program, to print the numbers `1`

to `n`

in a row with no
gaps between them, looks like:

n = int(input("Please input an integer: "))
for i in range(1,n):
print(i,end="")

The second version of the program, modified so that `n`

varies in a for loop from
1 to 5, so that you get a triangle of height 5, looks like:

for n in range(1, 6):
for i in range(1, n+1):
print(i, end="")
print()

## Exercise 4.2

`list(range(1, 4))`

`list(range(2, 10, 2))`

`list(range(-3, -20, -5))`

## Exercise 4.3

DAYS_OF_WEEK = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
"Sunday"]
for day in DAYS_OF_WEEK:
print("The first letter of ", day, " is ",
day[0], ".", sep="")