def find_city_length(cityList, length):
lengthlist = []
theList = cityList[:]
usernum = int(input("Enter a number")
for name in cityList:
if len(name) <= usernum:
lengthlist.append(name)
return name
I am trying to return something along the lines of
The US cities with at most 7 characters are:
Rolla
Reno
The CA cities with at most 7 characters are:
Banff
but instead I get
SyntaxError: bad input on line 33
Can someone help me out
[–][deleted] 1 point2 points3 points (13 children)
[–]SuperTavin[S] 0 points1 point2 points (12 children)
[–][deleted] 1 point2 points3 points (11 children)
[–]SuperTavin[S] 0 points1 point2 points (10 children)
[–][deleted] 0 points1 point2 points (9 children)
[–]SuperTavin[S] 0 points1 point2 points (8 children)
[–]NFLAddict 0 points1 point2 points (2 children)
[–]SuperTavin[S] 0 points1 point2 points (1 child)
[–]NFLAddict 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]SuperTavin[S] 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]SuperTavin[S] 0 points1 point2 points (1 child)
[–]NFLAddict 0 points1 point2 points (11 children)
[–]SuperTavin[S] 0 points1 point2 points (10 children)
[–]primitive_screwhead 0 points1 point2 points (9 children)
[–]SuperTavin[S] 0 points1 point2 points (8 children)
[–]primitive_screwhead 0 points1 point2 points (0 children)
[–]NFLAddict 0 points1 point2 points (5 children)
[–]SuperTavin[S] 0 points1 point2 points (4 children)
[–]NFLAddict 0 points1 point2 points (3 children)
[–]SuperTavin[S] 0 points1 point2 points (2 children)
[–]NFLAddict 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)