def printChar1(msg): """ potentially prints every character in the string""" for element in msg: print(element) def printChar2(msg): l = len(msg) for i in range(l): print(msg[i]) def printChar3(msg): l = len(msg) for i in range(0,l): print(msg[i]) def sumOfDigits(n): s = str(n) if len(s) > 1: return int(s[0]) + sumOfDigits(int(s[1:])) else: return n import math def QuadraticSolver(a,b,c): """ Solves the equation ax^2 + bx + c = 0 using the quadratic solver """ print(a,"x^2 + ",b,"x + ",c, " = 0") x1 = (-b + math.sqrt( b ** 2 - 4 * a * c) )/ (2 * a) x2 = (-b - math.sqrt( b ** 2 - 4 * a * c) )/ (2 * a) #print("x1: ",x1) #print("x2: ",x2) return [x1, x2] def print_list(L): """ Print every element in a list""" for element in L: print(element) def print_list2(L): for i in range(len(L)): print(L[i]) def sum_list(L): sum = 0 for num in L: sum += num return sum def double_list(L): for i in range(len(L)): L[i] = L[i]*2 return L def double_list2(L): newL = list() #newL = [] for item in L: newL.append(item*2) return(newL) def double_list3(L): return [item * 2 for item in L]