# CSPT19 Lecture 1
```
"""
Create a function that applies a discount d to every number in the list.
Examples:
- get_discounts([2, 4, 6, 11], "50%") ➞ [1, 2, 3, 5.5]
- get_discounts([10, 20, 40, 80], "75%") ➞ [7.5, 15, 30, 60]
- get_discounts([100], "45%") ➞ [45]
Notes:
- The discount is the percentage of the original price (i.e the discount of
"75%" to 12 would be 9 as opposed to taking off 75% (making 3)).
- There won't be any awkward decimal numbers, only 0.5 to deal with.
"""
def get_discounts(nums, percentage):
discount = int(percentage[:-1]) / 100
return [n * discount for n in nums]
print(get_discounts([2, 4, 6, 11], "50%"))
"""
Create a function that takes a string, checks if it has the same number of "x"s
and "o"s and returns either True or False.
- Return a boolean value (True or False).
- The string can contain any character.
- When no x and no o are in the string, return True.
Examples:
- XO("ooxx") ➞ True
- XO("xooxx") ➞ False
- XO("ooxXm") ➞ True (Case insensitive)
- XO("zpzpzpp") ➞ True (Returns True if no x and o)
- XO("zzoo") ➞ False
"""
def XO(txt):
lower_text = txt.lower()
return lower_text.count('x') == lower_text.count('o')
"""
Create a function that returns a list of strings that are sorted alphabetically
"""
def sort_list(lst):
return sorted(lst)
```