Showing posts with label HackerRank-Closures-Decorators. Show all posts
Showing posts with label HackerRank-Closures-Decorators. Show all posts

HackerRank Python Solution - Closures and Decorators - Name Directory

  • Let's use decorators to build a name directory! You are given some information about N people. Each person has a first name, last name, age, and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, print them in the order of their input.
  • For Henry Davids, the output should be:
Mr. Henry Davids
  • For Mary George, the output should be:
Ms. Mary George

HackerRank Python Solution - Closures and Decorators - Standardize Mobile Number Using Decorators

  • Let's dive into decorators! You are given N mobile numbers. Sort them in ascending order then print them in the standard format shown below:
+91 xxxxx xxxxx
  • The mobile numbers may have +91, 91, or 0 written before the actual 10-digit number. Alternatively, there may not be any prefix at all.
Input Format:
  • The first input line contains an integer N, the number of mobile phone numbers. N lines follow each having a mobile number.

You might also like

Deploy your Django web app to Azure Web App using App Service - F1 free plan

In this post, we will look at how we can deploy our Django app using the Microsoft Azure app service - a free plan. You need an Azure accoun...