Google's python class -


i wondering if give me hand questions on google python class, based around lists.

    # a. match_ends # given list of strings, return count of number of # strings string length 2 or more , first # , last chars of string same. # note: python not have ++ operator, += works. def match_ends(words):     print words   # b. front_x # given list of strings, return list strings # in sorted order, except group strings begin 'x' first. # e.g. ['mix', 'xyz', 'apple', 'xanadu', 'aardvark'] yields # ['xanadu', 'xyz', 'aardvark', 'apple', 'mix'] # hint: can done making 2 lists , sorting each of them # before combining them. def front_x(words):   return 

these questions, i've had several attempets , never got anywhere, wondering if could see answer , work backwards.

thanks! george

def match_ends(words):     count = 0     item in words:         if len(item) >= 2 , item[0] == item[-1]:             count += 1     return count   def front_x(words):     x_list = []     other_list = []     item in words:         if item[0].lower() == "x":             x_list.append(item)         else:             other_list.append(item)     x_list.sort()     other_list.sort()     return x_list + other_list 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -