File tree
Expand file treeCollapse file tree4 files changed
+51
-8
lines changed Expand file treeCollapse file tree4 files changed
+51
-8
lines changed Original file line number | Diff line number | Diff line change |
---|
|
2 | 2 | ## 1.2: Math Power
|
3 | 3 |
|
4 | 4 | **S-1: The problem**
|
5 |
| - |
6 | 5 | Take two numbers from the users. Calculate the result of second number power of the first number.
|
7 | 6 |
|
8 | 7 | <details>
|
@@ -42,5 +41,8 @@ print('Your result is: ', result)
|
42 | 41 | **[Try It:](/#)**
|
43 | 42 |
|
44 | 43 |
|
45 |
| -###### tags: `programmig-hero` `python` `float` `int` |
| 44 | +[](Random-Number.md) |
| 45 | + |
| 46 | + |
| 47 | +###### tags: `programmig-hero` `python` `float` `int` `math` |
46 | 48 |
|
Original file line number | Diff line number | Diff line change |
---|
|
| 1 | + |
| 2 | +## 1.3: Create a random number |
| 3 | + |
| 4 | +**S-1: The problem** |
| 5 | +Create a random number between 0 to 10 |
| 6 | + |
| 7 | +<details> |
| 8 | +<summary><b>S-2: Click Here For Show Hints</b></summary> |
| 9 | +<p>To create a random number, you have to import a built-in library named random. And then you can call the randint method on it</p> |
| 10 | +</details> |
| 11 | +<br> |
| 12 | + |
| 13 | +##### result = 4**3 |
| 14 | + |
| 15 | + |
| 16 | +#### S-3: Solution |
| 17 | + |
| 18 | +```python |
| 19 | +import random |
| 20 | + |
| 21 | +random_num = random.randint(0,10) |
| 22 | +print(random_num) |
| 23 | +``` |
| 24 | + |
| 25 | +**[Try It:](/#)** |
| 26 | + |
| 27 | + |
| 28 | +#### S-4: Quiz |
| 29 | +How will you generate a random integer number? |
| 30 | + |
| 31 | +1. math.random |
| 32 | +2. math.randint |
| 33 | +3. random.randomint |
| 34 | + |
| 35 | +**The answer is: 2** |
| 36 | + |
| 37 | +*S-5: Take Away* |
| 38 | + |
| 39 | +Use math.randomint to get a random integer. |
| 40 | + |
| 41 | + |
| 42 | +[](#) |
| 43 | + |
| 44 | + |
| 45 | +###### tags: `programmig-hero` `python` `float` `int` `math` |
Original file line number | Diff line number | Diff line change |
---|
|
4 | 4 | ### 1.1: User input to Number
|
5 | 5 |
|
6 | 6 | **S-1: The problem**
|
7 |
| - |
8 | 7 | Take two inputs from the user. One will be an integer. The other will be a float number. Then multiply them to display the output.
|
9 | 8 |
|
10 | 9 | <details>
|
@@ -41,11 +40,9 @@ print('Your result is: ', result)
|
41 | 40 | **[Try It:](/#)**
|
42 | 41 |
|
43 | 42 | #### S-5: Going Forward
|
44 |
| - |
45 | 43 | Going forward, we will write input and conversion in one line.
|
46 | 44 |
|
47 | 45 | #### S-6: Quiz
|
48 |
| - |
49 | 46 | Which one is used to convert string to a number?
|
50 | 47 |
|
51 | 48 |
|
@@ -60,7 +57,6 @@ Which one is used to convert string to a number?
|
60 | 57 |
|
61 | 58 | Use int or float to convert user input to a number.
|
62 | 59 |
|
| 60 | +[](/Easy-ones/Math-Power.md) |
| 61 | + |
63 | 62 | ###### tags: `programmig-hero` `python` `float` `int`
|
64 |
| - |
65 |
| - |
66 |
| -[](/Easy-ones/Math-Power.md) |
You can’t perform that action at this time.
0 commit comments