Presentation is loading. Please wait.

Presentation is loading. Please wait.

Xin Liu Jan 30, 2013. * By default, input() read a string from keyboard * This can be changed with an indirection operator ‘<‘ * python3 program.py <

Similar presentations


Presentation on theme: "Xin Liu Jan 30, 2013. * By default, input() read a string from keyboard * This can be changed with an indirection operator ‘<‘ * python3 program.py <"— Presentation transcript:

1 Xin Liu Jan 30, 2013

2 * By default, input() read a string from keyboard * This can be changed with an indirection operator ‘<‘ * python3 program.py < datafile.txt 4 1.23 42.0 12.8 999.9 nData = int(input()) for i in range(nData): print(input())

3 * Compared to Arithmetic mean, or average * The Geometric Mean of 2 numbers is defined as

4 * The Geometric Mean of 3 numbers is defined as

5 * The Geometric Mean of n numbers is defined as

6 * 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)

7 * Q & A for Assignment 1


Download ppt "Xin Liu Jan 30, 2013. * By default, input() read a string from keyboard * This can be changed with an indirection operator ‘<‘ * python3 program.py <"

Similar presentations


Ads by Google