Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def merge_lists(a, b):
- new_list = []
- for x in a:
- new_list.append(x)
- for x in b:
- new_list.append(x)
- return new_list
- def count_lower(s):
- """
- count the number of lower ascii letters in the string.
- :param s: string
- :return: int, count of lower ascii letters
- """
- list_of_lower_letters = ""
- for i in s:
- if i.islower():
- list_of_lower_letters += i
- return list_of_lower_letters
- print(count_lower("ASDsdsa"))
- def ends_with_pair(s):
- """
- if string ends with pair of symbols, return the index of the start of the pair.
- if not, return the index of the last symbol.
- else, return -1
- :param s: string
- :return: int, index of pair or index of single symbol or -1
- """
- if len(s) == 1:
- return 0
- elif s == "":
- return "-1"
- elif s[-1] == s[-2]:
- return len(s) - 2
- elif s[-1] != s[-2]:
- return len(s) - 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement