-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPower-Operator.py
More file actions
30 lines (24 loc) · 836 Bytes
/
Power-Operator.py
File metadata and controls
30 lines (24 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 17 22:17:17 2023
@author: Teja Ram Pooniya
@Program: Topic - Power Operator in Python
@Description:
the power operator is represented by two asterisks **.
It's used to raise a number to a specified power.
Here's how you can use the power operator.
"""
# Using the power operator
result = 2 ** 3 # 2 raised to the power of 3
print(result) # Output: 8
# Power operator with float numbers
float_result = 3.5 ** 2
print(float_result) # Output: 12.25
# Power operator with negative exponents
negative_exponent = 10 ** -2
print(negative_exponent) # Output: 0.01
"""
The power operator allows you to perform exponentiation easily in Python.
You can use it with both integer and floating-point numbers, as well as
with negative exponents to calculate reciprocals.
"""