Nate Brunelle Today: Strings, Type Casting CS1110 Nate Brunelle Today: Strings, Type Casting
PAs, OHs
Questions?
Last Time Values, types, operators
Values A “thing” Every value has a type
Values and Types (not exhaustive) Operators -50 ,0 ,5, 30, 512 int 3+7, 3*7, 3-7, 3/7 0.5, 1.2, 0.333333 float +, *, -, / ‘hi’, “hi”, ‘hello world! ✃’ str +, *int Print, input function print()
How to write strings ‘ “ “”” ‘’’
Escape Sequence Format: \? Says “the normal rule should not apply to this character = ?” \’ \” \n
Casting “Reshape” a value of one type to become another type: Functions for casting: General: type(value) int(‘7’) -> the int 7 str(7) -> the str ‘7’ float(‘7.0’)-> the float 7.0 type(value) gives the type of the value
Race_boaster