by CodeChum Admin
Let's try defining the size of the list and create the contents of it on our own! And then, to give off a sense of excitement, let's try accessing the value of a list element in a random index position!
Let's do this fast!
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5
Output
A line containing a string.
Cody!
n = int(input())
l = []
for i in range(n):
s = input()
l.append(s)
index = int(input())
print(l[index])
Comments
Leave a comment