def main(): scores = [88, 92, 79, 93, 85] mean = uf.mean(scores) curved = uf.add_five(scores) mean_c = uf.mean(curved) print("Scores:", scores) print("Original Mean:", mean, " New Mean:", mean_c) print(__name__) print(uf.__name__)
import other_script import useful_functions as uf print(4) print(other_script.num) scores = [20, 30, 40, 50] mean = uf.mean(scores)
import useful_functions as uf scores = [88, 92, 79, 93, 85] mean = uf.mean(scores) curved = uf.add_five(scores) mean_c = uf.mean(curved) print("Scores:", scores) print("Original Mean: ", mean, "New Mean: ", mean_c) print(__name__) print(uf.__name__)
import useful_functions as uf scores = [88, 92, 79, 93, 85] mean = uf.mean(scores) curved = uf.add_five(scores) mean_c = uf.mean(curved) print("Scores:", scores) print("Original mean: ", mean, " New mean: ", mean_c) print(__name__) print(uf.__name__)
import other_script import useful_functions as uf print(5 * 5) try: print(greeting) except Exception as e: print(e) finally: print("The above is to demonstrate you cannot access an object from another\ script directly using just it's identifier") print(other_script.greeting) scores = [90, 82, 74, 56, 50, 40, 22] average = uf.mean(scores) standardized = uf.add_five(scores) mean_s = uf.mean(standardized) print("Scores:", scores) print("Standardized scores:", standardized) print("Original mean:", average, " standardized mean:", mean_s) print(__name__) print(uf.__name__)
import other_script import useful_functions as uf # To import a script, use the import keyword. # Import statement are written at the top of a python file. # You don't need to type out the file extension. num_list = [1,2,3,4,5] mean = uf.mean(num_list) # you need to type the entire name of the module if you don't add an alias. print(mean)
import useful_functions as func scores = [88, 92, 79, 93, 85] mean = func.mean(scores) curved = func.add_five(scores) mean_c = func.mean(curved) print("Scores:", scores) print("Original Mean:", mean, " New Mean:", mean_c)
import useful_functions as af scores = [88, 92, 79, 93, 85] mean = af.mean(scores) curved = af.add_five(scores) mean_c = af.mean(curved) print("Scores ;", scores) print("Original Mean :", mean) print("New Mean :", mean_c) print(__name__) print(af.__name__)