Skip to content

Commit 2541a03

Browse files
committed
added next problem button
1 parent 9800ca3 commit 2541a03

27 files changed

+183
-150
lines changed

Check-Prime/Prime-Numbers.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
## 7.1 Check Prime:
22

3-
### S-1: The problem
3+
### The problem
44
For a given number, check whether the number is a prime number or not.
55

6-
### S-2: Hint
6+
### Hint
77
A number is a prime number. If that number is only divisible by 1 and the number itself.
88

99
This means a prime number is not divisible by any numbers between 1 and the number itself.
1010

1111
So, to check prime, you can start dividing the number from 2. And then increase it by 1. If the number gets divided, then it’s not a prime number.
1212

13-
### S-3: The solution
13+
### The solution
1414

1515
```python
1616
def is_prime(num):
@@ -32,7 +32,7 @@ else:
3232

3333
[Try it on Programming Hero button]
3434

35-
### S-4: Explanation
35+
### Explanation
3636
The core part of the algorithm is the is_prime function.
3737

3838
There we start a for loop the range(2, num). Because we want to know that the number is not divisible by any number except 1 or the number itself.
@@ -49,10 +49,10 @@ If the number doesn’t get divided by any numbers smaller than the number, it w
4949

5050
Then we will return True. Because it didn’t get divided, by any numbers. Hence, it will be a prime number.
5151

52-
### S-5: Many Solution
52+
### Many Solution
5353
There are other solutions to this problem as well. We encourage you to google, “check prime number python”. In that way, you will learn a lot.
5454

55-
### S-6: Take Away
55+
### Take Away
5656
A prime number is only divisible by 1 and the number itself.
5757

5858
 

Computations/Calculate-Grades.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## 6.3 Calculate grades
22

3-
### S-1: The problem
3+
### The problem
44
Calculate grade of five subjects.
55

6-
### S-2: Hint
6+
### Hint
77
So, you have to take five inputs. These will be the marks of five subjects. Then, create the average.
88

99
Once you have the average. It just running an if-else. And decide the grade.
1010

11-
### S-3: The Solution
11+
### The Solution
1212
```python
1313
print('Enter your marks:')
1414
sub1=int(input("First subject: "))
@@ -32,7 +32,7 @@ else:
3232
```
3333
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
3434

35-
### S-4: Explanation
35+
### Explanation
3636
Calculation of average is easy. Add them all and then divide by the count. As we are taking numbers for 5 subjects we are dividing the total by 5.
3737

3838
After that, we are running a simple if-else to determine the grade.

Computations/Complex-Interest.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
## 6.2: Compound Interest
22

3-
### S-1: The Problem
3+
### The Problem
44
Take money borrowed, interest and duration as input. Then, compute the compound interest rate.
55

6-
### S-2: Hint
6+
### Hint
77
Compound interest formula is:
88

99
A = P(1+r/100)t
1010

1111
Here, P is the principal amount; it is the amount that you borrowed. r is the interest rate in percentage and t is the time.
1212

13-
### S-3: Solution
13+
### Solution
1414

1515
```python
1616
def compound_interest(principle, rate, time):
@@ -28,14 +28,14 @@ print("Interest Amount is:", total_due)
2828

2929
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
3030

31-
### S-4: Explanation
31+
### Explanation
3232
Inside the function, just look into the power calculation.
3333

3434
**(1 + rate / 100) time**
3535

3636
Rest of the part should be easy for you.
3737

38-
### S-5: Take Away
38+
### Take Away
3939
To apply the same power on multiple things, put them inside parentheses and then apply the power.
4040

4141

Computations/Gravitational-Force.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## 6.4 Gravitational Force
22

3-
### S-1: The Problem
3+
### The Problem
44
Compute gravitational force between two objects.
55

6-
### S-2: Hint
6+
### Hint
77
The formula for gravitational force is
88

99
**F = G m1m2/r2**
@@ -12,7 +12,7 @@ Here G is the gravitational constant. Its value is 6.673*10-11
1212

1313
So, take three input from the users. The mass of the first object, the mass of the second object and the distance between them.
1414

15-
### S-3: Solution
15+
### Solution
1616

1717
```python
1818
mass1 = float(input("First mass: "))
@@ -28,7 +28,7 @@ print("The gravitational force is:", round(force, 5),"N")
2828

2929
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
3030

31-
### S-4: Explanation
31+
### Explanation
3232
The calculation is simple. Only two things need to be learned from this.
3333

3434
**Have a look, how we wrote 6.673*10-11**

Computations/Simple-Interest.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
---
44

5-
### S-1: The Problem
5+
### The Problem
66
You borrowed $5000 for 2 years with 2% interest per year.
77
Calculate the simple interest to know how much you have to pay?
88

9-
### S-2: Hint
9+
### Hint
1010
Just take amount, duration and interest rate.
1111

1212
You have to multiply these three. And, don’t forget: you have to convert percent to a fraction by dividing it by 100.
1313

14-
### S-3: The Solution
14+
### The Solution
1515

1616
```python
1717
principle = int(input("Money you borrowed: "))
@@ -26,7 +26,7 @@ print("Simple interest is:", simple_interest)
2626

2727
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
2828

29-
### S-4: Explanation
29+
### Explanation
3030
Read the code. I think you don’t need any extra explanation here.
3131

3232

Computations/Triangle-Area.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## 6.5 Triangle Area
1+
## Triangle Area
22
---
33

4-
### S-1: The Problem
4+
### The Problem
55
Take three sides of a triangle. And then calculate the area of the triangle.
66

7-
### S-2: How it works
7+
### How it works
88
To calculate the area of the triangle. First, calculate the half of the perimeter. Here perimeter is the sum of each side of the triangle.
99

1010
Let’s call it s.
@@ -16,7 +16,7 @@ s = (a+b+c)/2
1616
area = √(s(s-a)*(s-b)*(s-c))
1717
```
1818

19-
### S-3: the code
19+
### the code
2020
```python
2121
import math
2222

@@ -33,7 +33,7 @@ print('Area of your triangle is ', area)
3333
```
3434
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
3535

36-
### S-4: Explanation
36+
### Explanation
3737
To calculate the square root. We used the math module. And call math.sqrt.
3838

3939
```python
@@ -47,16 +47,19 @@ Similarly, math.sqrt(25) will give 5 as output.
4747

4848
This is something new you have learned this time.
4949

50-
### S-5: Quiz
50+
### Quiz
5151

52-
1. How would you calculate the square root of a number.
53-
2. Use math.square.root
54-
3. Use math.sqroot
55-
4. Use math.sqrt
52+
How would you calculate the square root of a number.
53+
1. Use math.square.root
54+
2. Use math.sqroot
55+
3. Use math.sqrt
5656

57-
**The answer is: 3**
57+
<details>
58+
<summary><b>Show Answer</b></summary>
59+
<p>The answer is: 3</p>
60+
</details>
5861

59-
### S-6: Take Away
62+
### Take Away
6063
The math module has a lot of math-related functionalities.
6164

6265

Conversions/Celsius-to-Fahrenheit.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 4.2 Celsius to Fahrenheit
22

3-
### S-1: The problem
3+
### The problem
44
Take the temperature in degrees Celsius and convert it to Fahrenheit.
55

66
<details>
@@ -12,7 +12,7 @@ Take the temperature in degrees Celsius and convert it to Fahrenheit.
1212

1313
Think for a second...How will you multiply a variable by 9 and then divide by 5? and then add 32. Can you do it without looking at the solution?
1414

15-
### S-3: The solution
15+
### The solution
1616
```python
1717
celsius = float(input("Enter temperature in degrees Celsius: "))
1818

Conversions/Decimal-to-binary-recursive.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 4.4: Decimal to Binary (recursive)
22

3-
### S-1: The Problem
3+
### The Problem
44
Convert a decimal number to binary number using a recursive function.
55
<details>
66
<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.
99
So, don’t worry if you felt confused. You are not alone. I am in the same condition as well.</p>
1010
</details>
1111

12-
### S-3: Recursive
12+
### Recursive
1313

1414
```python=
1515
def dec_to_binary(n):
@@ -27,7 +27,7 @@ print(" ")
2727

2828
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
2929

30-
### S-4: Explanation
30+
### Explanation
3131
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.
3232

3333
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=''.
4040
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.
4141

4242

43-
### S-6: Take Away
43+
### Take Away
4444
There are multiple ways to format the print string. Google it, when needed.
4545

4646

Conversions/Decimal-to-binary.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## 4.4: Decimal to Binary
22

3-
### S-1: The Problem
3+
### The Problem
44
Convert a decimal number to binary number.
55

6-
### S-2: Decimal vs Binary
6+
### Decimal vs Binary
77

88
The numbers that we use every day is called decimal number. A decimal number could have any of the 10 digits (0, 1, 2, 3, 4,5 6, 7, 8, 9).
99

@@ -34,7 +34,7 @@ Then you will reverse the list.
3434
Finally, you have to put the binary bits (0 and 1) in one number to get the final binary. </p>
3535
</details>
3636

37-
### S-4: Solution
37+
### Solution
3838
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:
3939

4040
```python
@@ -58,7 +58,7 @@ print("Your binary is:", binary)
5858
```
5959
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
6060

61-
### S-5: Explanation
61+
### Explanation
6262
You have seen the remainder and dividing the number with // before. That is the core part of this decimal to a binary algorithm.
6363

6464
So, this part should be easier for you:
@@ -89,16 +89,19 @@ Try to read this explanation and code multiple times. And, if needed, come back
8989
If you keep trying and revisiting , again and again, these will start making sense.
9090

9191

92-
### S-6: Quiz
92+
### Quiz
9393

9494
1. What is a binary number?
9595
2. Numbers written on a trash bin
9696
3. Numbers that use 0,1 only
9797
4. Numbers with any 2 digits
9898

99-
#### The answer is : 2
99+
<details>
100+
<summary><b>Show Answer</b></summary>
101+
<p>The answer is : 2</p>
102+
</details>
100103

101-
### S-7: Take Away
104+
### Take Away
102105
Binary numbers use 0 and 1 only.
103106

104107

Conversions/Miles-to-Kilometers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 4.1: Miles to Kilometers
22

3-
#### S-1: The Problem
3+
#### The Problem
44
Convert miles to kilometers.
55

66
<details>
@@ -12,7 +12,7 @@ Convert miles to kilometers.
1212
Now, think what you can do with this information. </p>
1313
</details>
1414

15-
### S-3: The solution
15+
### The solution
1616

1717
```python
1818
miles = float(input("Enter distance in miles: "))
@@ -22,7 +22,7 @@ print("Distance in Kilometers:", kilometers)
2222

2323
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**
2424

25-
### S-4: Explanation
25+
### Explanation
2626
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.
2727

2828
The kilometers is your answer.

0 commit comments

Comments
 (0)