I am trying to write a code that prints hello and a different number on each line. Sample output would look like this:
hi 21
hi 22
hi 23
etc. However I am getting a list index out of range error for my for loop.
Here is my code:
number = [21,22,23]
for x in number:
print('hi',number[x],'\n')
I am new to programming and any help would be greatly appreciated!