Python has the capability of carrying out calculations.
Enter a calculation directly into the Python console, and it will output the answer.
>> 2 + 2
>>> 5 + 4 – 3
Python also carries out multiplication and division, using an asterisk to indicate multiplication and a forward slash to indicate division.
Use parentheses to determine which operations are performed first.
>> 2 * (3 + 4)
>>> 10 / 2
The minus sign indicates a negative number.
Operations are performed on negative numbers, just as they are on positive ones.
>>> (-7 + 2) * (-4)
Dividing by zero in Python produces an error, as no answer can be calculated.
>> 11 / 0
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ZeroDivisionError: division by zero
CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE.
©️ License: All Rights Reserved
CONTACT HOLLA TECH – LEARN SUPPORT