Xin Liu Jan 30, 2013
* By default, input() read a string from keyboard * This can be changed with an indirection operator ‘<‘ * python3 program.py < datafile.txt nData = int(input()) for i in range(nData): print(input())
* Compared to Arithmetic mean, or average * The Geometric Mean of 2 numbers is defined as
* The Geometric Mean of 3 numbers is defined as
* The Geometric Mean of n numbers is defined as
* Download data files from pages.cpsc.ucalgary.ca/~liuxin * What if the number of floats is zero? nData = int(input()) product = 1.0 for i in range(nData): product = product * float(input()) product = product ** (1/nData) print("The Geometric Mean is: ", product)
* Q & A for Assignment 1