Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

1

INPUT, PROCESSING, AND OUTPUT

Submitted By: Bharti Dawani

Submitted To: Mr Noor Nabi


2 PERFORMING CALCULATIONS:

Python has numerous operators that can be used to perform mathematical


calculations. you can use the built-in mathematical operators, such as
addition ( + ), subtraction ( - ), division ( / ), and multiplication ( * ) and
many more.
3 PYTHON OPERATORS:

• 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:

A named constant is a name that represents a special value, such as a magic


number(unexplained value that appears in a program’s code).
Example of declared named constant:

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:

• It makes programs more self-explanatory.


• Named constants is that widespread changes can easily be made to the
program.
• It helps to prevent the typographical errors that are common when using
magic numbers.
10

You might also like