To send us your message, you need to log in first.
Multiplying a Number by a String
Multiplying a number by a string is possible, unlike addition. What do you think we mean by multiplying a number by a string? Run the code below to see the answer.
Copied!
Multiplying a number by a string causes the string to be repeated as many times as the number. This operation saves time. Imagine you want to repeat a word a hundred times; using multiplication with a string makes this task very easy. Look at the following code:
Copied!
Next Line
So far, whenever we wanted to print text in several lines, we had to use the same number of print statements. However, we can print text in multiple lines using just one print statement. Here you go, and this is the character "\n".
Copied!
The character backslash n(\n) placed anywhere in a string means moving to the next line. This character is very useful because it allows us to repeat the print command less often.