Type Casting

  • int() function:To convert it to a number
  • str() function:To convert it to a string
  • float() function: To convert it to a float
  • bool() function: To convert it to a bool

age=int(input())
print("Your age is "+str(age)+" years old")
15
Your age is 15 years old
numbers = [1, 2, 3, 4, 2, 5]
# check if numbers is instance of list
result = isinstance(numbers, list)
print(result)
True