Assignment and Built-in Scalar Types#
Learning Objectives#
After working through this topic, you should be able to:
List several built-in scalar types in Python
Assign and manipulate scalar variables in Python
Convert variables between different types
Materials#
Video:
Download the slides.
See the Documentation of Python built-in types.
Quiz#
If you need to represent a real number, in Python you would use ...
Which of the following are properties about floats?
Which values can a Boolean take?
You want to convert a number that you stored as the following
string "200,000.000" to a float object corresponding to the number 200000.0.
Which of the following codes do you think will do this (try on a notebook if
you want)?
What do you expect the following code to produce? True == 1.0
What is the result of summing the Boolean values True,
False and True (True + False + True)?