Download presentation
Presentation is loading. Please wait.
1
Nate Brunelle Today: Strings, Type Casting
CS1110 Nate Brunelle Today: Strings, Type Casting
2
PAs, OHs
3
Questions?
4
Last Time Values, types, operators
5
Values A “thing” Every value has a type
6
Values and Types (not exhaustive)
Operators -50 ,0 ,5, 30, 512 int 3+7, 3*7, 3-7, 3/7 0.5, 1.2, float +, *, -, / ‘hi’, “hi”, ‘hello world! ✃’ str +, *int Print, input function print()
7
How to write strings ‘ “ “”” ‘’’
8
Escape Sequence Format: \?
Says “the normal rule should not apply to this character = ?” \’ \” \n
9
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
10
Race_boaster
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.