Type Conversion

Converting between data types

Interview Relevant: Data manipulation

Type Conversion

Explicitly convert between types (casting).

Code Examples

Casting values to different types.

python
1int("123")      # 123
2float("3.14")   # 3.14
3str(100)        # "100"
4bool(1)         # True
5bool(0)         # False
6list("abc")     # ['a', 'b', 'c']

AI Tutor

Ask about the topic

Sign in Required

Please sign in to use the AI tutor

Sign In