>>> nautical_directions = "\n".join(["fore","aft","starboard","port"]) >>> print(nautical_directions) fore aft starboard port >>> names = ["Garcia", "O'Kelly", "Davis"] >>> "-".join(names) "Garcia-O'Kelly-Davis"
Note that join will trigger an error if we try to join anything other than strings.
>>> python_vareties.append('Blood Python') >>> print(python_vareties) ['Burmese Python', 'African Rock Python', 'Ball Python', 'Reticulated Python', 'Angolan Python', 'Blood Python']
def median(numbers): numbers.sort() if len(numbers) % 2: middle_index = int(len(numbers)/2) return numbers[middle_index] else: right_of_middle = len(number)//2 left_of_middle = right_of_middle -1 return (numbers[right_of_middle] + numbers[left_of_middle])/2