Answer to Question #254372 in Python for Hazel

Question #254372

4. What's in There?

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!




1
Expert's answer
2021-10-22T01:35:04-0400
n = int(input())
l = []

for i in range(n):
    s = input()
    l.append(s)

index = int(input())

print(l[index])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS