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

Connected

Exercise

Other variable types

In the previous exercise, you worked with the integer Python data type:

  • int, or integer: a number without a fractional part. savings, with the value 100, is an example of an integer.

Next to numerical data types, there are three other very common data types:

  • float, or floating point: a number that has both an integer and fractional part, separated by a point. 1.1, is an example of a float.
  • str, or string: a type to represent text. You can use single or double quotes to build a string.
  • bool, or boolean: a type to represent logical values. It can only be True or False (the capitalization is important!).

Instructions

100 XP
  • Create a new float, half, with the value 0.5.
  • Create a new string, intro, with the value "Hello! How are you?".
  • Create a new boolean, is_good, with the value True.