asked 17.9k views
1 vote
How could I compare only the 1st letter of strings in the "names" list with the input?

How could I compare only the 1st letter of strings in the "names" list with-example-1
asked
User Adrian S
by
8.5k points

1 Answer

4 votes

So let's say we have the list:

list1 = ["Apple", "Banana", "Cherry"]

If we print this with indexes:
print(list1[0])

It'll show:
Apple

Now, we can add another index like:
print(list1[0][0])

And that'll show
A

answered
User Zumzum
by
7.6k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.