1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Python

Connected

Exercise

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.

Instructions 1/2

undefined XP
  • 1
    • Add savings and new_savings and assign it to total_savings.
    • Use type() to print the resulting type of total_savings.
  • 2
    • Calculate the sum of intro and intro and assign the result to doubleintro.
    • Print out doubleintro. Did you expect this?