Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Python Help For Beginner

$
0
0
Hi folks,

Another python question for the forum, this one should be easy. I am trying to complete the following exercise and am stumped with the last section. I am asked to print only the items in the list with exactly 5 characters. If anyone can help me out that would be much appreciated.

Code:

# Create list with these four entries: roads, streams, parks, contours
value1 = "roads"
value2 = "streams"
value3 = "parks"
value4 = "contours"

List = [value1, value2, value3, value4]

# Print the first entry in the list to the interactive window
print List[0]

# Use a loop to print every entry that has exactly 5
# characters to the interactive window

print List

Thanks,

Brett

Viewing all articles
Browse latest Browse all 2485

Trending Articles