We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ada7c8e commit 11fee8aCopy full SHA for 11fee8a
philalandCoin_qn3.py
@@ -0,0 +1,37 @@
1
+def myFunc(N):
2
+ coin_list = []
3
+ while True:
4
+ x = int(N/2)
5
+ N = N - x
6
+ coin_list.append(x)
7
+ if N==2:
8
+ if 1 in coin_list:
9
+ coin_list.append(2)
10
+ return len(coin_list)
11
+ else:
12
+ coin_list.append(1)
13
14
15
+
16
+test = int(input("No of test:"))
17
+ans_list = []
18
+flag = 0
19
+if test>=1 and test<=100:
20
+ for i in range(1,test+1):
21
+ print("Enter Value of N")
22
+ N = int(input())
23
+ if N>=1 and N<=5000:
24
+ value = myFunc(N)
25
+ ans_list.append(value)
26
27
+ flag = 1
28
+ print("ERROR")
29
+ break
30
+else:
31
32
33
34
+if flag == 0:
35
+ print("OUTPUT...")
36
+ for val in ans_list:
37
+ print(val)
0 commit comments