This one is easy. We took an input number from the user, and then pass it to a function.
36
+
37
+
In the function, we have a list and we ran a loop. This loop runs a range. This means we will get numbers from 0 to num. Here, num is the number that the user entered.
38
+
39
+
Inside the loop, we have an if block. In the if block, we have two conditions. One condition says i % 3 ==0
40
+
41
+
This means if you divide i by 3 and there will not be any remainder. If there is no remainder then the number is divisible by 3.
42
+
43
+
Similarly, i%5==0 means the number is divisible by 5.
44
+
45
+
As we have and between both conditions, to go, insider, the if-block, the i has to be divisible by 3 and also has to be divisible by 5.
46
+
47
+
Inside the if block, we are appending the number in the result list. And then return the list.
48
+
49
+
That’s how we are getting every number divisible by 3 and 5.
50
+
51
+
> Isn’t it simple and cool?
52
+
53
+
#### S-5: Quiz
54
+
If you want to get the numbers that are either divisible by 3 or divisible by 7, which condition will you use?
55
+
56
+
1. n%3 == 0 or n%7 ==0
57
+
2. n%3 == 0 and n%7 ==0
58
+
3. n%3 == 0 || n%7 ==0
59
+
60
+
**The answer is: 1**
61
+
62
+
#### S-6: Take Away
63
+
Remainder(%) will be 0, if the number gets divided.
In this galaxy, we will focus on real-world coding related problem-solving.
43
+
44
+
The problem-solving means, we will take a small programming problem. We will think about the process of solving the problem and then we will solve it.
41
45
42
-
> n this galaxy, we will focus on real-world coding related problem-solving.<br><br>The problem-solving means, we will take a small programming problem. We will think about the process of solving the problem and then we will solve it.
43
46
44
47
#### S-3: Explanation
45
48
After the solution, we will explain the answer. Convey the concept and strategy to solve it.
@@ -48,7 +51,7 @@ After the solution, we will explain the answer. Convey the concept and strategy
48
51
Solving coding problems helps you to think about the problem. It will make you a better developer. Moreover, if you want to participate in a programming contest, you need to practice problem-solving.
49
52
50
53
#### S-5: Interview
51
-
> Besides, large companies like Google, Facebook, Amazon, Uber, etc. ask a lot of problem-solving related questions in their job interview.<br><br>If you want to work any of these large companies, you should practice problem-solving.
54
+
Besides, large companies like Google, Facebook, Amazon, Uber, etc. ask a lot of problem-solving related questions in their job interview.<br><br>If you want to work any of these large companies, you should practice problem-solving.
52
55
53
56
54
57
#### S-6: Many solutions
@@ -57,7 +60,7 @@ Here we are focusing on the thinking and strategies to solve a problem. However,
57
60
Always keep an open mind to learn multiple solutions to solve a problem.
58
61
59
62
#### S-7: Let’s Start
60
-
Let’s start your journey. Let’s solve every problem you face.
63
+
> Let’s start your journey. Let’s solve every problem you face.
0 commit comments