''' DS2000 Spring 2020 Sample code from class -- functions January 14, 2020 ''' def count_undergrads(): ''' Function: count_undergrads Parameters: none Returns: Number of undergrad students enrolled at NEU, an int ''' return 18000 def acceptance_rate(applied, admitted): ''' Function: acceptance_rate Parameters: num students who applied (int), num students admitted (int) Returns: acceptance rate, float ''' acceptance = admitted / applied acceptance = acceptance * 100 return acceptance def pct_khoury(num_khoury): ''' Function: pct_khoury Parameters: num of khoury student (int) Returns: pct of u-grads who are in Khoury (float 0-1) ''' ug = count_undergrads() pct = num_khoury / ug return pct def tuition_increase(start_tuition, end_tuition): ''' Function: tuition_increase Parameters: two floats, the starting tuition and ending tuition Returns: a float (0-1), the percentage increase from start to end ''' diff = end_tuition - start_tuition increase = diff / start_tuition return increase def main(): # Here in main, we're just calling all our functions, # saving the result and printing them out ug = count_undergrads() print("There are", ug, "undergrad students at Northeastern") rate = acceptance_rate(20000, 5000) print("NEU's acceptance rate was ", round(rate, 2), "%", sep = "") khoury = int(input("How many Khoury undergrad students are there?\n")) pct = pct_khoury(khoury) print(round(pct, 2), "of undergrads are in Khoury College") increase = tuition_increase(49471, 51522) print("Tuition went up by ", round(increase * 100, 2), "%", sep = "") main()