You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Computations/Gravitational-Force.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Compute gravitational force between two objects.
6
6
## Hint
7
7
The formula for gravitational force is
8
8
9
-
**F = G m1m2/r2**
9
+
`F = G m^1m^2/r^2`
10
10
11
11
Here G is the gravitational constant. Its value is 6.673*10-11
12
12
@@ -31,13 +31,13 @@ print("The gravitational force is:", round(force, 5),"N")
31
31
## Explanation
32
32
The calculation is simple. Only two things need to be learned from this.
33
33
34
-
**Have a look, how we wrote 6.673*10-11**
34
+
`Have a look, how we wrote 6.673*10-^11`
35
35
36
-
> Also, note that while displaying the force, we used a round function. In the round function, we passed the force, the variable we want to display. Then we passed another parameter to tell, how many decimal points we want to display.
36
+
Also, note that while displaying the force, we used a round function. In the round function, we passed the force, the variable we want to display. Then we passed another parameter to tell, how many decimal points we want to display.
Copy file name to clipboardexpand all lines: Conversions/Decimal-to-binary.md
+6-17
Original file line number
Diff line number
Diff line change
@@ -21,17 +21,6 @@ While dividing, you will keep the remainder. These remainders will be used to bu
21
21
22
22
Then, reverse the order of the reminder, to get the binary number.
23
23
24
-
**Give me more: non-premium**
25
-
Let's say, you want to get the binary number of 233. You will start dividing by 2, store the remainder on a list. And then, set the number by the result of the division
26
-
27
-
So, if you divide 233 by 2, the result will be 116 and the remainder will be 1.
28
-
29
-
Keep doing it until the number becomes 0.
30
-
31
-
Then you will reverse the list.
32
-
33
-
Finally, you have to put the binary bits (0 and 1) in one number to get the final binary.
34
-
35
24
## Solution
36
25
I looked into the below code 7 times to understand. Still trying to figure it out...So, spend some time here to look at the code:
37
26
@@ -89,10 +78,10 @@ If you keep trying and revisiting , again and again, these will start making sen
89
78
90
79
## Quiz
91
80
92
-
1.What is a binary number?
93
-
2. Numbers written on a trash bin
94
-
3. Numbers that use 0,1 only
95
-
4. Numbers with any 2 digits
81
+
What is a binary number?
82
+
1. Numbers written on a trash bin
83
+
2. Numbers that use 0,1 only
84
+
3. Numbers with any 2 digits
96
85
97
86
<details>
98
87
<summary><b>Show Answer</b></summary>
@@ -105,7 +94,7 @@ Binary numbers use 0 and 1 only.
Copy file name to clipboardexpand all lines: Easy-ones/Floor-Division.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -27,8 +27,10 @@ print(result)
27
27
When you divide one number by another you get two things. One is called the integer part of the division. Another is the remainder.
28
28
29
29
To get the quotient (result without the remainder), you can use two-division symbols.
30
-
30
+
```python
31
31
print(37//10)
32
+
37=3*10+7
33
+
```
32
34
33
35
## Think different
34
36
Another alternative approach is to use the floor method from the math module. If you pass a number with a fraction to the math.floor function, it will return you the integer part of the number.
Copy file name to clipboardexpand all lines: Easy-ones/Math-Power.md
+4-6
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,8 @@ Take two numbers from the users. Calculate the result of second number power of
7
7
## Hints
8
8
To power, you will need to use two asterisks symbols (two multiplication symbols). For example 4 to the power 3 will be
9
9
10
-
```python
11
-
result =4**3
12
-
```
10
+
11
+
`result = 4**3`
13
12
14
13
## Solution
15
14
```python
@@ -26,20 +25,19 @@ Python has a built-in function named `pow`. The pow is a short form of the word
26
25
27
26
28
27
## Alternative Solution
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.
28
+
Python has a built-in function named pow. 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
29
31
30
```python
32
31
base_num =int(input('Give me the base number: '))
33
32
power_num =int(input('Give me the power number: '))
34
33
result =pow(base_num, power_num)
35
34
print('Your result is: ', result)
36
-
37
35
```
38
36
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
Copy file name to clipboardexpand all lines: Harder/Permutations.md
+4-13
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,6 @@ For example, you have 1,2,3. Now all possible order is
16
16
17
17
So, the permutation is a way to find all the possible order or sequence of elements.
18
18
19
-
Give me more: non-premium
20
-
One important part of the solution is to select one element and get a list excluding that element. Let's say you want to select the list without the 4th position element.
21
-
22
-
All the elements before the 4th index element will be lst[:4]. This is from beginning to before the 4th element.
23
-
24
-
Similarly, all the elements after the fourth position will be lst[4+1:]. This is from the 4+1 or 5th element to the end.
25
-
26
-
This concept will help in permutation to select one element and place it in multiple places.
27
-
28
19
```python
29
20
lst = [2,3,4,6,11,16,7,8]
30
21
before = lst[:4]
@@ -81,19 +72,19 @@ Finally, we have to join the current element with the rest of the list. To do so
81
72
82
73
The loop variable p is a list. Whereas the current is an element. You can not add
83
74
84
-
3 + [2,1]
75
+
`3 + [2,1]`
85
76
86
77
That’s why we put current in a list as well so that it becomes a list as well. In the following example,
87
78
88
-
[3] + [2, 1]
79
+
`[3] + [2, 1]`
89
80
90
81
This will create [3, 2, 1]. That’s why we did [current] + p to make the final permutation.
91
82
92
83
This code is harder. It will take a few practices to become comfortable with it.
0 commit comments