CS 371: Module 1: Python Basics Part 1
Module content developed by Professor Tralie. Module engine developed by Professor Tralie and Professor Mongan.
Please watch the video below, and click the Next
button to continue when you're finished
Notes
- Arithmetic expressions in python work just as they do in in Java or C++. So the +, -, /, and * operators do just what they did before. The only new one is
a**b
which means raisea
to thebth
power - Variables also are assigned with
=
, but types are not specified when defining them. Instead, they are inferred at runtime. For instance, any time two numbers are divided, the result is always cast as afloat
- To see what type a variable currently is, write
type(variable)