Expand|Select|Wrap|Line Numbers
- cars = ['honda' , 'ford' , 'kia' , 'toyota' , 'jaguar' , 'daimler' , 'citroen' , 'peugeot' , 'skoda']
- # Print the longest and the shortest words in the gunners list
- shortest=[]
- longest=[]
- shortest=[]
- for i in cars:
- if len(i) > len(longest):
- longest = i
- print longest
- for i in cars:
- shortest = cars[0]
- if len(i) < len(shortest):
- shortest = [i]
- elif len(i) == len(shortest):
- shortest = shortest.append[i]
- print shortest
when i try to execute the code i get the above error on the shortest = shortest.append[i] line. i'm new to programming so go easy! thanks!!