Skip to content
Advertisement

How to reverse a list containing elements as strings starting with uppercase letter followed by lowercase letters

def combine_lists(list1, list2):
  # Generate a new list containing the elements of list2
  # Followed by the elements of list1 in reverse order
  list3=list2.extend(list1.reverse())
  return list3


Jamies_list = ["Alice", "Cindy", "Bobby", "Jan", "Peter"]                     
Drews_list = ["Mike", "Carol", "Greg", "Marcia"]

print(combine_lists(Jamies_list, Drews_list))

Advertisement

Answer

See if this is what you are looking for :

>>> Jamies_list = ["Alice", "Cindy", "Bobby", "Jan", "Peter"]
>>> Drews_list = ["Mike", "Carol", "Greg", "Marcia"]
>>>
>>> Drews_list + Jamies_list[::-1]
['Mike', 'Carol', 'Greg', 'Marcia', 'Peter', 'Jan', 'Bobby', 'Cindy', 'Alice']
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement