Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Math in Strings | Bring All the Topics Together
Data Types in Python
course content

Course Content

Data Types in Python

Data Types in Python

1. Getting Familiar With Numbers in Python
2. True or False?
3. Strings
4. Bring All the Topics Together

bookMath in Strings

It's time to let you dive deeper into programming! 😎

You've examined that the + operator can be applied to statements that are related to one data type: concatenate strings, add some numbers, etc. But please look at this simple example where input and output are pretty understandable for you: 😊

1
print(12 * 4)
copy

However, multiplication works not only with equal data types, but with various ones too. This means that we can multiply your string by a number. For instance, if we multiply it by 2, the string will be printed twice. Take a look at the following example:

1
print('12' * 4)
copy

Note

We can multiply a string only by an integer number.

Task

Time to practice!

Follow the algorithm and fill in the gaps:

  1. Print the first string twice.
  2. Print the second string three times.
  3. Print the third string once.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 6
toggle bottom row

bookMath in Strings

It's time to let you dive deeper into programming! 😎

You've examined that the + operator can be applied to statements that are related to one data type: concatenate strings, add some numbers, etc. But please look at this simple example where input and output are pretty understandable for you: 😊

1
print(12 * 4)
copy

However, multiplication works not only with equal data types, but with various ones too. This means that we can multiply your string by a number. For instance, if we multiply it by 2, the string will be printed twice. Take a look at the following example:

1
print('12' * 4)
copy

Note

We can multiply a string only by an integer number.

Task

Time to practice!

Follow the algorithm and fill in the gaps:

  1. Print the first string twice.
  2. Print the second string three times.
  3. Print the third string once.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 6
toggle bottom row

bookMath in Strings

It's time to let you dive deeper into programming! 😎

You've examined that the + operator can be applied to statements that are related to one data type: concatenate strings, add some numbers, etc. But please look at this simple example where input and output are pretty understandable for you: 😊

1
print(12 * 4)
copy

However, multiplication works not only with equal data types, but with various ones too. This means that we can multiply your string by a number. For instance, if we multiply it by 2, the string will be printed twice. Take a look at the following example:

1
print('12' * 4)
copy

Note

We can multiply a string only by an integer number.

Task

Time to practice!

Follow the algorithm and fill in the gaps:

  1. Print the first string twice.
  2. Print the second string three times.
  3. Print the third string once.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

It's time to let you dive deeper into programming! 😎

You've examined that the + operator can be applied to statements that are related to one data type: concatenate strings, add some numbers, etc. But please look at this simple example where input and output are pretty understandable for you: 😊

1
print(12 * 4)
copy

However, multiplication works not only with equal data types, but with various ones too. This means that we can multiply your string by a number. For instance, if we multiply it by 2, the string will be printed twice. Take a look at the following example:

1
print('12' * 4)
copy

Note

We can multiply a string only by an integer number.

Task

Time to practice!

Follow the algorithm and fill in the gaps:

  1. Print the first string twice.
  2. Print the second string three times.
  3. Print the third string once.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 6
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt