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: Status/Day 1.md
+28-25Lines changed: 28 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
2
2
# Question 1
3
-
### Level 1
4
-
-----------------
5
3
6
-
**Question:**
4
+
### **Question:**
7
5
8
-
***Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
6
+
> ***Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
9
7
between 2000 and 3200 (both included).The numbers obtained should be printed in a comma-separated sequence on a single line.***
10
8
11
9
--------------------------------------
12
-
### Hints: Consider use range(#begin, #end) method
10
+
### Hints:
11
+
> ***Consider use range(#begin, #end) method.***
12
+
13
13
---------------------------------------
14
14
15
15
**Main author's Solution: Python 2**
16
-
```
16
+
```python
17
17
l=[]
18
18
for i inrange(2000, 3201):
19
19
if (i%7==0) and (i%5!=0):
@@ -24,7 +24,7 @@ print ','.join(l)
24
24
----------------------------------------
25
25
26
26
**My Solution: Python 3**
27
-
```
27
+
```python
28
28
for i inrange(2000,3201):
29
29
if i%7==0and i%5!=0:
30
30
print(i,end=',')
@@ -33,19 +33,19 @@ print("\b")
33
33
-------------------------------
34
34
35
35
# Question 2
36
-
### Level 1
37
-
---------------
38
36
39
-
**Question:**
37
+
### **Question:**
40
38
41
-
***Write a program which can compute the factorial of a given numbers.The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8
39
+
> ***Write a program which can compute the factorial of a given numbers.The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8
42
40
Then, the output should be:40320***
43
41
44
42
--------------------
45
-
### Hints:In case of input data being supplied to the question, it should be assumed to be a console input.
43
+
### Hints:
44
+
>***In case of input data being supplied to the question, it should be assumed to be a console input.***
45
+
46
46
---------------
47
47
**Main author's Solution: Python 2**
48
-
```
48
+
```python
49
49
deffact(x):
50
50
if x ==0:
51
51
return1
@@ -58,7 +58,7 @@ print fact(x)
58
58
**My Solution: Python 3**
59
59
60
60
***Using While Loop**
61
-
```
61
+
```python
62
62
n =int(raw_input()) #input() function takes input as string type
63
63
#int() converts it to integer type
64
64
fact =1
@@ -69,7 +69,7 @@ print fact(x)
69
69
print(fact)
70
70
```
71
71
***Using For Loop**
72
-
```
72
+
```python
73
73
n =int(input()) #input() function takes input as string type
74
74
#int() converts it to integer type
75
75
fact =1
@@ -80,21 +80,24 @@ print fact(x)
80
80
-------------------
81
81
82
82
# Question 3
83
-
## Level 1
84
-
--------------------
85
-
**Question:**
86
83
87
-
***With a given integral number n, write a program to generate a dictionary that contains (i, i * i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.Suppose the following input is supplied to the program: 8***
>***With a given integral number n, write a program to generate a dictionary that contains (i, i x i) such that is an integral number between 1and n (both included). and then the program should print the dictionary.Suppose the following inputis supplied to the program: 8***
0 commit comments