TASK 1: Pint the numbers from 1 to 20 using " for " loop
The Sample of Output:
The numbers from 1 to 20:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
The code 1:
print('The numbers from 1 to 20:\n')
for value in range(1,21):
print(value)
The code 2:
print('The numbers from 1 to 20:\n')
numbers = []
for value in range(1,21):
numbers.append(value)
print(numbers)
The code 3:
print('The numbers from 1 to 20:\n')
numbers = [value for value in range(1,21)]
print(numbers)