Week 3 Programming
Week 3 Programming
• N
NOTE: There is an exception to the left-to-right rule. When two ** operators share an operand, the
operators execute right-to-left. For example, the expression 2**3**4 is evaluated as 2**(3**4).
4 STRING CONCATENATION:
Concatenation is the process of adding one string to the end of another string.
You can concatenate two different strings together and also the same string to
itself multiple times using (+).
5 MORE ABOUT THE PRINT FUNCTION:
The print function normally displays a line of output. For example, the following three statements will
produce three lines of output:
print('One')
print('Two')
print('Three')
#output
One
Two
three
6 PYTHON’S ESCAPE CHARACTERS:
7 DISPLAYING FORMATTED OUTPUT WITH
F-STRINGS:
F-strings are a special type of string literal that allow you to create messages
that contain the contents of variables, and you can format numbers in a
variety of ways.
8 NAMED CONSTANTS:
Notice the named constant is written in all uppercase letters to indicate that the variable should
be treated as a constant.
9 ADVANTAGES OF USING NAMED CONSTANTS: