Prisma Interview Question

Hacker rank test in python