def separateNumbers(s): if len(s)==1:

print("NO")

return for i in range(1, len(s)//2+1): genstr = s[:i]

prev = int(genstr) while len(genstr) < len(s): next = prev+1

genstr+=str(next)

prev = next if genstr == s:

print("YES", s[:i])

return print("NO")

First, we will check the edge case, If length of ** s **is equals to…

Web Scraping is the process of collecting structured data from web sites, Suppose you want to monitor price of a specific stock from a website and store it in your computer it would be tedious to copy the price from the website everyday, here’s where Web Scraping comes into play…

Link:- DefaultDict (github.com)

from collections import defaultdict

n, m = map(int, input().split())d = defaultdict(list)for i in range(n):

d[input()].append(i+1)for j in range(m):

s = input() if s in d:

print(*d[s]) else:

print(-1)

First we will import defaultdict from collections module of Python. …

from collections import Counterdef pickingNumbers(a):

countNums = Counter(a)

maxnum=0 for i in range(1, 100):

maxnum = max(maxnum, countNums[i]+countNums[i+1])

return maxnum

We will import Counter from Python’s collections module. …

def sockMerchant(n, ar):

countOfSocks = []

for sock in set(ar):

countOfSocks.append(ar.count(sock)) return sum([i//2 for i in countOfSocks])

First, we will declare an empty list, ** countOfSocks**. In which we will store the count of each type of sock.

countOfSocks = []

Link:- DOFTP (github.com)

`def dayOfProgrammer(year):`

if year < 1700 or year > 2700:

return

elif year==1918:

return '26.09.1918'

elif year < 1918:

if year%4==0:

return '12.09.'+str(year)

else:

return '13.09.'+str(year)

elif year > 1918:

if year%400==0 or year%4==0 and year%100!=0:

return '12.09.'+str(year) …

def beautifulDays(i, j, k):

beautifulDays = 0 for day in range(i, j+1):

rev = int(str(day)[::-1])

if abs(rev-day)%k==0:

beautifulDays+=1

return beautifulDays

Firstly we declare a variable called ** beautifulDays** and initialize it to 0.

beautifulDays = 0

Then, we use a for loop and iterate from ** i** i.e the starting…

Source Code Link:- ACM ICPC Team (github.com)

`def acmTeam(topic):`

ans = []

for i in range(n):

for j in range(i+1, n):

know=0

for a,b in zip(topic[i], topic[j]):

if a=='1' or b=='1':

know+=1

ans.append(know)

return [max(ans), ans.count(max(ans))]

Firstly, we will declare an empty list called ** ans, **Later on we will store…

Link:- Knag (github.com)

def kangaroo(x1, v1, x2, v2):

if x1 < x2 and v1 < v2:

return 'NO' else:

if v1!=v2 and (x2-x1)%(v2-v1)==0:

return 'YES'

else:

return 'NO'

First, We check whether **x1** is less than **x2** and **v1** is less than **v2**. If the condition is True then it…

Kevin and Stuart want to play the ‘**The Minion Game**’.

**Game Rules**

Both players are given the same string, ** S**.

Both players have to make substrings using the letters of the string

Stuart has to make words starting with consonants.

Kevin has to make words starting with vowels. …