Python Guide V1.2.11

5238is like 52368 identifiers variables

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • • • • • +,R:!R++R+3 is like R(+(+(R(+3)))) • *,/,//,%:!8!/63!//62!*63!%62!is like! !!!!!!!!!!(((8!/!3)!//!2)!*!3)!%!2 • +,R:!8!/!36*!4!+!R2**4!%!5!is like !!!!((8!/!3)!*!4)!+!((R(2**4))6%!5) • <,<=,!=,==,>=,>,is,in:!! 5!+!2!<!3!*!8!is like (5!+!2)!<!(36*!8) Identifiers • Variables (mixed case) can change value sumOfSquares!=!0.0 • Constants (all uppercase with _ ) should stay fixed: SECS_PER_MIN!=!60 Math functions: dir(math) Assignment import6math!as!m!!#!for!float,!or! import!cmath!as!m!#!for!complex! To avoid "m.": from!math!import!* • m.acos(x) inverse cosine [radians] • m.asin(x),!m.atan(x)!#!similar • m.ceil(x) least integer ≥ x![math only] • m.cos(x)! !cosine of!x!given in radians • m.e 2.718281828459045 x • m.exp(x) e • m.factorial(x) x! [math only] • m.floor(x) biggest int ≤ x![math only] • m.log(x)! !natural log of!x • m.log10(x)! !log base 10 of!x • m.pi! !3.141592653589793 • m.sin(x),!m.tan(x)!#!see!m.cos • m.sqrt(x) square root of x import!random!#!f...
View Full Document

This document was uploaded on 02/14/2014 for the course COMP 1012 at Manitoba.

Ask a homework question - tutors are online