Download presentation
Presentation is loading. Please wait.
Published byCoral Carpenter Modified over 9 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.