This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: approximate, the division result is approximate D. 3.45 divided by 3.0 is a little more than 1.15, there’s nothing to explain E. We should have used integer division // for the correct result 6 Some math library functions 7 Some math library functions • Using math library – import math – Prefix function name with math. 8 Explicit type conversion • Force int to float or float to int 9 Rounding • Allows specifying the number of decimal places 10 1D array of numbers [element , element 1 , …, elemen n1 ] – 0based indices – len function returns length of array, i.e. the number of elements (“n”) 11 Traversal of 1D array, version 1 12 • Using for loop – Directly on elements Traversal of 1D array, version 2 13 • Using range function … Traversal of 1D array , version 2 14 • Using range function … and for loop on index SortMin in Python 15...
View
Full Document
 Spring '08
 Staff
 1d array, Python Shell window, Builtin numeric operations

Click to edit the document details