- Conference Session
- Computers and Software in Teaching Mathemathetics
- Collection
- 2009 Annual Conference & Exposition
- Authors
-
Ali Farahani, National University, San Diego
- Tagged Divisions
-
Mathematics
the product of the twosets. The set union, intersection and difference operations are all available in Python thusenabling one to verify Demorgan’s law for sets.Logic:In logic students typically are requires to generate truth tables for a variety of Booleanexpressions. Python directly supports conjunction and disjunction in terms of the build inprimitives and and or, the negation is done using not. A nested loop can be constructed togenerate the truth table for standard logic operators such as the and for p in (True, False): for q in (True, False): print "%10s %10s %10s" % ( p, q, p and q)Once again the code is highly intuitive and requires minimal coding ability. The print