I have solved the question for #2 and has made it well structured. I am still learning so i wasn't to push it properly in another branch. This code works fine please merge it @sagarmittal1
[X] Appropriate title of PR
[X] Making another branch with an appropriate name.
[X] Comment on file in the top with the link of the question
[X] Any dependent changes have been merged and published in downstream modules
[X] My code follows the style guidelines of this project
[X] I have commented my code, particularly in hard-to-understand areas
I have solved the question for #2 and has made it well structured. I am still learning so i wasn't to push it properly in another branch. This code works fine please merge it @sagarmittal1