<!-- Day page sponsor slot: empty, so nothing is shown. When sold, add the line below
     right under this comment. Logo 120x40 px (send 240x80), text up to 60 characters:
     <p align="right"><sub>Sponsored</sub><br><a href="URL?ref=github-day-23"><img src="../assets/sponsors/NAME.png" height="40" align="middle" alt="NAME"></a>&nbsp; <a href="URL?ref=github-day-23">One-line message →</a></p> -->

<!-- day-nav:top -->
<p align="center"><a href="Day_22.md">← Day 22</a> &nbsp;·&nbsp; <a href="../README.md#days">All 24 days</a> &nbsp;·&nbsp; <a href="Day_24.md">Day 24 →</a></p>
<!-- /day-nav:top -->

# The extended part of the repository starts from this page. Previous 94 problems were collected from the repository mentioned in intro. The following problems are collected from Hackerrank and other resources from internet.All the given solutions are in python 3.

# Question 95

### **Question**

> **_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._**

> **_If the following string is given as input to the program:_**
>
> ```
> 5
> 2 3 6 6 5
> ```
>
> **_Then, the output of the program should be:_**
>
> ```
> 5
> ```

### Hints

> **_Make the scores unique and then find 2nd best number_**

---

<details markdown="1">
<summary><b>💡 Show solutions</b> (try it yourself first!)</summary>

**My Solution: Python 3**

```python
n = int(input())
arr = map(int, input().split())
arr = list(set(arr))
arr.sort()
print(arr[-2])
```

---

```python
'''
Solution by: mishrasunny-coder
'''
num = int(input("Enter num: "))
L = []

while True:
    L.append(num)
    num = int(input("Enter another: "))
    if num == 0:
        break

L1 = list(set(L[:]))
L2 = sorted(L1)
print(L2)

print(f'The runner up is {L2[-2]}')
```

---
```python
'''Solution by: KailashS3 
'''
num = int(input())
scores = list(map(int, input().split(' ')))
winner = max(scores)
lst = []

if len(scores) != num:
    print('length of score is greater than input given')
else:
    for score in scores:
	if winner > score:
	    lst.append(score)

runnerup = max(lst)
print(runnerup)
```

</details>

---

# Question 96

### **Question**

> **_You are given a string S and width W.
> Your task is to wrap the string into a paragraph of width._**

> **_If the following string is given as input to the program:_**
>
> ```
> ABCDEFGHIJKLIMNOQRSTUVWXYZ
> 4
> ```
>
> **_Then, the output of the program should be:_**
>
> ```
> ABCD
> EFGH
> IJKL
> IMNO
> QRST
> UVWX
> YZ
> ```

### Hints

> **_Use wrap function of textwrap module_**

---

<details markdown="1">
<summary><b>💡 Show solutions</b> (try it yourself first!)</summary>

**My Solution: Python 3**

```python
import textwrap

def wrap(string, max_width):
    string = textwrap.wrap(string,max_width)
    string = "\n".join(string)
    return string

if __name__ == '__main__':
    string, max_width = input(), int(input())
    result = wrap(string, max_width)
    print(result)
```

---
```python
"""Solution by: mishrasunny-coder
"""
import textwrap

string = input()
width = int(input())

print(textwrap.fill(string,width))
```
---
```python
"""solution by  : Prashanth
"""
from textwrap import wrap
x = str(input(': '))
w = int(input())
z = list(wrap(x, w))
for i in z:
    print(i)
```
---
```python
"""solution by  : saxenaharsh24
"""
import textwrap
string = input('')
print('\n'.join(textwrap.wrap(string, width= int(input('')))))
```
---
```python
"""solution by  : popomaticbubble
"""
import itertools
string = input("> ")
width_length = int(input("What is the width of the groupings? "))

def grouper(string, width):
    iters = [iter(string)] * width
    return itertools.zip_longest(*iters, fillvalue='')

def displayer(groups):
    for x in groups:
        if x == '':
            continue
        else:
            print(''.join(x))

displayer(grouper(string, width_length))
```

```python
"""solution by  : Arutrr0
"""
def splitter(word, width):
    while len(word) > 0:
        snippet = ""
        if len(word) < width:
            width = len(word)
        for i in range(width):
            snippet += word[i]
        print(snippet)
        word = word[width:]

splitter("ABCDEFGHIJKLIMNOQRSTUVWXYZ", 4)
```

</details>

---

# Question 97

### **Question**

> **_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.)_**

> **_Different sizes of alphabet rangoli are shown below:_**
>
> ```
> #size 3
>
> ----c----
> --c-b-c--
> c-b-a-b-c
> --c-b-c--
> ----c----
>
> #size 5
>
> --------e--------
> ------e-d-e------
> ----e-d-c-d-e----
> --e-d-c-b-c-d-e--
> e-d-c-b-a-b-c-d-e
> --e-d-c-b-c-d-e--
> ----e-d-c-d-e----
> ------e-d-e------
> --------e--------
> ```

### Hints

> **_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._**

---

<details markdown="1">
<summary><b>💡 Show solutions</b> (try it yourself first!)</summary>

**My Solution: Python 3**

```python

import string
def print_rangoli(size):
    n = size
    alph = string.ascii_lowercase
    width = 4 * n - 3

    ans = []
    for i in range(n):
        left = '-'.join(alph[n - i - 1:n])
        mid = left[-1:0:-1] + left
        final = mid.center(width, '-')
        ans.append(final)

    if len(ans) > 1:
        for i in ans[n - 2::-1]:
            ans.append(i)
    ans = '\n'.join(ans)
    print(ans)


if __name__ == '__main__':
    n = int(input())
    print_rangoli(n)
```
---
```python
'''Solution by: suggula jaswanth
'''
def rangoli(n):
    # your code goes here
    l1=list(map(chr,range(97,123)))
    x=l1[n-1::-1]+l1[1:n]
    mid=len('-'.join(x))
    for i in range(1,n):
        print('-'.join(l1[n-1:n-i:-1]+l1[n-i:n]).center(mid,'-'))
    for i in range(n,0,-1):
        print('-'.join(l1[n-1:n-i:-1]+l1[n-i:n]).center(mid,'-')) 
rangoli(5)

```


</details>

---

# Question 98

### **Question**

> **_You are given a date. Your task is to find what the day is on that date._**

**Input**

> **_A single line of input containing the space separated month, day and year, respectively, in MM DD YYYY format._**
>
> ```
> 08 05 2015
> ```

**Output**

> **_Output the correct day in capital letters._**
>
> ```
> WEDNESDAY
> ```

---

### Hints

> **_Use weekday function of calender module_**

---

<details markdown="1">
<summary><b>💡 Show solutions</b> (try it yourself first!)</summary>

**Solution:**

```python
import calendar

month, day, year = map(int, input().split())

dayId = calendar.weekday(year, month, day)
print(calendar.day_name[dayId].upper())
```


</details>

---

# Question 99

### **Question**

> **_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._**

**Input**

> **_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._**
>
> ```
> 4
> 2 4 5 9
> 4
> 2 4 11 12
> ```

**Output**

> **_Output the symmetric difference integers in ascending order, one per line._**
>
> ```
> 5
> 9
> 11
> 12
> ```

---

### Hints

> **_Use \'^\' to make symmetric difference operation._**

---

<details markdown="1">
<summary><b>💡 Show solutions</b> (try it yourself first!)</summary>

**Solution:**

```python
if __name__ == '__main__':
    n = int(input())
    set1 = set(map(int,input().split()))

    m = int(input())
    set2 = set(map(int, input().split()))

    ans = list(set1 ^ set2)
    ans.sort()
    for i in ans:
        print(i)
```


</details>

---

<!-- day-nav:bottom -->
<p align="center">
<sub><b>UP NEXT</b></sub><br>
<a href="Day_24.md"><img src="../assets/days/day-24.svg" width="240" alt="Day 24, questions 100 to 103: Word counts &amp; recursion"></a><br>
<a href="Day_22.md">← Day 22</a> &nbsp;·&nbsp; <a href="../README.md#days">All 24 days</a>
</p>
<!-- /day-nav:bottom -->

[**_Discussion_**](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/issues/3)
