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: Conversions/Decimal-to-binary-recursive.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## 4.4: Decimal to Binary (recursive)
2
2
3
-
### S-1: The Problem
3
+
### The Problem
4
4
Convert a decimal number to binary number using a recursive function.
5
5
<details>
6
6
<summary><b>S-3: Click Here For Show Hints</b></summary>
@@ -9,7 +9,7 @@ Convert a decimal number to binary number using a recursive function.
9
9
So, don’t worry if you felt confused. You are not alone. I am in the same condition as well.</p>
10
10
</details>
11
11
12
-
### S-3: Recursive
12
+
### Recursive
13
13
14
14
```python=
15
15
def dec_to_binary(n):
@@ -27,7 +27,7 @@ print(" ")
27
27
28
28
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
29
29
30
-
### S-4: Explanation
30
+
### Explanation
31
31
The core part of the logic is simple. If the number is greater than 1, call the dec_to_binary function again. And, while calling, send the result of dividing operation as the input number.
32
32
33
33
If you remember, the while loop in the previous code problem is similar. In the while loop, we were going back to the next iteration with n = n//2
@@ -40,7 +40,7 @@ While printing, we have one extra thing called end=''.
40
40
The purpose of end='' is to print the output in the same line. If you don’t add end='', every print output will be displayed in a new line.
41
41
42
42
43
-
### S-6: Take Away
43
+
### Take Away
44
44
There are multiple ways to format the print string. Google it, when needed.
Copy file name to clipboardexpand all lines: Conversions/Miles-to-Kilometers.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## 4.1: Miles to Kilometers
2
2
3
-
#### S-1: The Problem
3
+
#### The Problem
4
4
Convert miles to kilometers.
5
5
6
6
<details>
@@ -12,7 +12,7 @@ Convert miles to kilometers.
12
12
Now, think what you can do with this information. </p>
13
13
</details>
14
14
15
-
### S-3: The solution
15
+
### The solution
16
16
17
17
```python
18
18
miles =float(input("Enter distance in miles: "))
@@ -22,7 +22,7 @@ print("Distance in Kilometers:", kilometers)
22
22
23
23
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
24
24
25
-
### S-4: Explanation
25
+
### Explanation
26
26
Just take a number from the user. Allow the user to enter a float number. Then, multiply that number by 1.609344. Keep the multiplication in the kilometers variable.
0 commit comments