Thoughts on Python numerics


a + b The sum of a and b
a - b The difference of b from a
a * b The product of a and b
a / b The decimal quotient a divided by b
a // b The truncated quotient of of a divided by b
a ** b The remainder when b does not evenly divide b
a % b The remainder when b does not evenly divide a

s + t  The contatenation (gluing) of strings s and t
n * s  If n is positive, it is the concatenation of s with itself n-1 times; otherwise it is the ''
s * n  Equals n * s

import math

gives its code access to the standard Python math library.

 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.