import math #Functions def pf1(m, n): print(m*"*"+n*" "+m*"*") def pf2(x): return (10+x**2)/(1+x**3) #Conditionals def pc1(years): if years < 0: return 'no such era' elif years < 70: return 'cenozoic' elif years < 541: return 'paleocoiz' elif years < 2800: return 'proterozoic' elif years < 4000: return 'archaic' elif years < 4570: return 'hadean' else: return 'no such era' def pc2(x): if x > 0: return math.sqrt(x) return x**2 #you can also use an else here, but that is one line more #Lists def pl1(lst1, lst2): result = [] for element in lst1: if element not in lst2: result.append(element) return result def pl2(lst1): result = [] for element in lst1: result.append(element**2) return result #Strings def ps1(string): counter = 0 for char in string: if char == 'z': counter += 1 return counter def ps2(string): result = [] for char in string: if char == 'a': result.append('e') elif char == 'e': result.append('i') elif char == 'i': result.append('a') else: result.append(char) return ''.join(result)