This week we went over Regular Expressions (RegEx)
The solution to Last Week's HW problem:
n = int(input())
blue, red = int(input()),int(input())
with_replace = False
if n is not 1:
with_replace = input()=='N'
num,dem = 1,1
for i in range(n):
if input()=='B':
num*=blue
dem*=(blue+red)
if with_replace:
blue-=1
else:
num*=red
dem*=(blue+red)
if with_replace:
red-=1
print(f'{num}/{dem}')
The solution to "Capturing & Non-Capturing Groups" in Hackerrank:
Regex_Pattern=r'(ok){3,}'
import re
print(str(bool(re.search(Regex_Pattern, input()))).lower())