Skip to content

Commit 507adbf

Browse files
committed
math-power added
1 parent 914dec0 commit 507adbf

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

Easy-ones/Math-Power.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
## 1.2: Math Power
3+
4+
**S-1: The problem**
5+
6+
Take two numbers from the users. Calculate the result of second number power of the first number.
7+
8+
<details>
9+
<summary><b>S-2: Click Here For Show Hints</b></summary>
10+
<p>To power, you will need to use two asterisks symbols (two multiplication symbols). For example 4 to the power 3 will be</p>
11+
</details>
12+
<br>
13+
14+
**result = 4**3**
15+
16+
17+
#### S-3: Solution
18+
19+
```python
20+
base_num = int(input('Give me the base number: '))
21+
power_num = int(input('Give me the power number: '))
22+
result = base_num ** power_num
23+
print('Your result is: ', result)
24+
```
25+
26+
**[Try It:](/#)**
27+
&nbsp;
28+
#### S-4: Think Different
29+
Python has a built-in function named pow [blue]. The pow is a short form of the word power. And you can pass 2 numbers to the pow function. It will give you the second number as a power of the first number.
30+
31+
32+
#### S-5: Alternative Solution
33+
Python has a built-in function named pow [blue]. The pow is a short form of the word power. And you can pass 2 numbers to the pow function. It will give you the second number as a power of the first number.
34+
35+
```python
36+
base_num = int(input('Give me the base number: '))
37+
power_num = int(input('Give me the power number: '))
38+
result = pow(base_num, power_num)
39+
print('Your result is: ', result)
40+
41+
```
42+
**[Try It:](/#)**
43+
44+
&nbsp;
45+
###### tags: `programmig-hero` `python` `float` `int`
46+

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ Use int or float to convert user input to a number.
6262
&nbsp;
6363
###### tags: `programmig-hero` `python` `float` `int`
6464

65+
[NEXT PAGE](/Easy-ones/Math-Power.md)
66+
![NEXT PAGE](/assets/next-arrow.png)

assets/next-arrow.png

11.3 KB
Loading

0 commit comments

Comments
 (0)