Operations with other types
Variables come in different types in Python. You can see the type of a variable by using type()
. For example, to see type of a
, execute: type(a)
.
Different types behave differently in Python. When you sum two strings, for example, you'll get different behavior than when you sum two integers or two booleans.
Time for you to test this out.
This exercise is part of the course
Introduction to Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
savings = 100
new_savings = 40
# Calculate total_savings using savings and new_savings
____
print(total_savings)
# Print the type of total_savings
print(____)