Concatenation
The Plus (+) sign, when applied to
two strings becomes a concatenation operator.
If we want the Plus (+) sign to be a
concatenate not an adder, we must ensure that both its arguments are strings.
Output will be like,
Using + to concatenate strings lets we construct the output in a more precise way than with a pure print () function. Even if enriched with the end= and sep= keyword arguments.
Replication
The Asterisk (*) sign, when applied
to a string & a number becomes a replication operator.
This operator replicates the string,
the same number of times specified by the number.
A number less than or equal to zero
produces an empty string.
Let's draw a triangle.
So, the output is
No comments:
Post a Comment