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

Exercise

Combining data types

Different types of data types have different properties. For example, strings and floats cannot be mathematically combined. To convert a variable x to an integer, you can use the command int(x). Similarly, to convert a variable y to a string, you can use the command str(y).

It's time for you to change some data types to complete and print a statement.

The variables company_1, year_1, and revenue_1 are available in your workspace.

Instructions

100 XP
  • Convert the data type of variables year_1, and revenue_1 to string.
  • Use these new variables to create and print the following sentence: "The revenue of Apple in 2017 was $229.23 billion."