Skip to content

Commit 5cde733

Browse files
committed
All url are updated
1 parent 19e4fd5 commit 5cde733

File tree

2 files changed

+225
-0
lines changed

2 files changed

+225
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,5 @@
7878
* **[Day 21](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_21.md "Day 21 Status")**- ***Question 85-89***
7979

8080
* **[Day 22](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_22.md "Day 22 Status")**- ***Question 90-94***
81+
82+
* **[Day 23](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_23.md "Day 23 Status")**- ***Question 95-99***

Status/Day_24.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Question 100
2+
3+
### **Question**
4+
5+
>***Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up.***
6+
7+
>***If the following string is given as input to the program:***
8+
>```
9+
>5
10+
>2 3 6 6 5
11+
>```
12+
>***Then, the output of the program should be:***
13+
>```
14+
>5
15+
>```
16+
### Hints
17+
> ***Make the scores unique and then find 2nd best number***
18+
19+
----------------------
20+
**My Solution: Python 3**
21+
```python
22+
n = int(input())
23+
arr = map(int, input().split())
24+
arr = list(set(arr))
25+
arr.sort()
26+
print(arr[-2])
27+
```
28+
---------------------
29+
30+
# Question 96
31+
32+
### **Question**
33+
34+
>***You are given a string S and width W.
35+
Your task is to wrap the string into a paragraph of width.***
36+
37+
>***If the following string is given as input to the program:***
38+
>```
39+
>ABCDEFGHIJKLIMNOQRSTUVWXYZ
40+
>4
41+
>```
42+
>***Then, the output of the program should be:***
43+
>```
44+
>ABCD
45+
>EFGH
46+
>IJKL
47+
>IMNO
48+
>QRST
49+
>UVWX
50+
>YZ
51+
>```
52+
53+
### Hints
54+
> ***Use wrap function of textwrap module***
55+
56+
----------------------
57+
58+
**My Solution: Python 3**
59+
```python
60+
import textwrap
61+
62+
def wrap(string, max_width):
63+
string = textwrap.wrap(string,max_width)
64+
string = "\n".join(string)
65+
return string
66+
67+
if __name__ == '__main__':
68+
string, max_width = input(), int(input())
69+
result = wrap(string, max_width)
70+
print(result)
71+
```
72+
---------------------
73+
74+
# Question 97
75+
76+
### **Question**
77+
78+
>***You are given an integer, N. Your task is to print an alphabet rangoli of size N. (Rangoli is a form of Indian folk art based on creation of patterns.)***
79+
80+
>***Different sizes of alphabet rangoli are shown below:***
81+
>```
82+
>#size 3
83+
>
84+
>----c----
85+
>--c-b-c--
86+
>c-b-a-b-c
87+
>--c-b-c--
88+
>----c----
89+
>
90+
>#size 5
91+
>
92+
>--------e--------
93+
>------e-d-e------
94+
>----e-d-c-d-e----
95+
>--e-d-c-b-c-d-e--
96+
>e-d-c-b-a-b-c-d-e
97+
>--e-d-c-b-c-d-e--
98+
>----e-d-c-d-e----
99+
>------e-d-e------
100+
>--------e--------
101+
>```
102+
### Hints
103+
>***First print the half of the Rangoli in the given way and save each line in a list. Then print the list in reverse order to get the rest.***
104+
105+
----------------------
106+
**My Solution: Python 3**
107+
```python
108+
109+
import string
110+
def print_rangoli(size):
111+
n = size
112+
alph = string.ascii_lowercase
113+
width = 4 * n - 3
114+
115+
ans = []
116+
for i in range(n):
117+
left = '-'.join(alph[n - i - 1:n])
118+
mid = left[-1:0:-1] + left
119+
final = mid.center(width, '-')
120+
ans.append(final)
121+
122+
if len(ans) > 1:
123+
for i in ans[n - 2::-1]:
124+
ans.append(i)
125+
ans = '\n'.join(ans)
126+
print(ans)
127+
128+
129+
if __name__ == '__main__':
130+
n = int(input())
131+
print_rangoli(n)
132+
```
133+
---------------------
134+
135+
136+
# Question 98
137+
138+
### **Question**
139+
140+
>***You are given a date. Your task is to find what the day is on that date.***
141+
142+
**Input**
143+
>***A single line of input containing the space separated month, day and year, respectively, in MM DD YYYY format.***
144+
>```
145+
>08 05 2015
146+
>```
147+
148+
149+
**Output**
150+
>***Output the correct day in capital letters.***
151+
>```
152+
>WEDNESDAY
153+
>```
154+
155+
156+
----------------------
157+
### Hints
158+
> ***Use weekday function of calender module***
159+
160+
----------------------
161+
162+
**Solution:**
163+
```python
164+
import calendar
165+
166+
month, day, year = map(int, input().split())
167+
168+
dayId = calendar.weekday(year, month, day)
169+
print(calendar.day_name[dayId].upper())
170+
```
171+
----------------
172+
173+
174+
# Question 99
175+
176+
### **Question**
177+
178+
>***Given 2 sets of integers, M and N, print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either M or N but do not exist in both.***
179+
180+
**Input**
181+
>***The first line of input contains an integer, M.The second line contains M space-separated integers.The third line contains an integer, N.The fourth line contains N space-separated integers.***
182+
>```
183+
>4
184+
>2 4 5 9
185+
>4
186+
>2 4 11 12
187+
>```
188+
189+
**Output**
190+
>***Output the symmetric difference integers in ascending order, one per line.***
191+
>```
192+
>5
193+
>9
194+
>11
195+
>12
196+
>```
197+
198+
199+
----------------------
200+
### Hints
201+
> ***Use \'^\' to make symmetric difference operation.***
202+
203+
----------------------
204+
205+
**Solution:**
206+
```python
207+
if __name__ == '__main__':
208+
n = int(input())
209+
set1 = set(map(int,input().split()))
210+
211+
m = int(input())
212+
set2 = set(map(int, input().split()))
213+
214+
ans = list(set1 ^ set2)
215+
ans.sort()
216+
for i in ans:
217+
print(i)
218+
```
219+
----------------
220+
221+
[***go to previous day***](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_22.md "Day 22")
222+
223+
[***go to next day***](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_24.md "Day 24")

0 commit comments

Comments
 (0)