-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from HighnessAtharva/master
imports sorted and code formatted
- Loading branch information
Showing
95 changed files
with
605 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
''' | ||
""" | ||
Title : Python Evaluation | ||
Subdomain : Built-Ins | ||
Domain : Python | ||
Author : Ahmedur Rahman Shovon | ||
Created : 15 July 2016 | ||
Problem : https://www.hackerrank.com/challenges/python-eval/problem | ||
''' | ||
""" | ||
eval(input()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
''' | ||
""" | ||
Title : Decorators 2 - Name Directory | ||
Subdomain : Closures and Decorators | ||
Domain : Python | ||
Author : Ahmedur Rahman Shovon | ||
Created : 15 July 2016 | ||
Updated : 3 April 2021 | ||
Problem : https://www.hackerrank.com/challenges/decorators-2-name-directory/problem | ||
''' | ||
""" | ||
|
||
import operator | ||
|
||
|
||
def person_lister(func): | ||
def inner(people): | ||
return [func(p) for p in sorted(people, key = lambda x: (int(x[2])))] | ||
return [func(p) for p in sorted(people, key=lambda x: (int(x[2])))] | ||
|
||
return inner | ||
|
||
|
||
@person_lister | ||
def name_format(person): | ||
return ("Mr. " if person[3] == "M" else "Ms. ") + person[0] + " " + person[1] | ||
|
||
if __name__ == '__main__': | ||
|
||
if __name__ == "__main__": | ||
people = [input().split() for i in range(int(input()))] | ||
print(*name_format(people), sep='\n') | ||
print(*name_format(people), sep="\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
''' | ||
""" | ||
Title : Collections.OrderedDict() | ||
Subdomain : Collections | ||
Domain : Python | ||
Author : Ahmedur Rahman Shovon | ||
Created : 15 July 2016 | ||
Problem : https://www.hackerrank.com/challenges/py-collections-ordereddict/problem | ||
''' | ||
import collections, re | ||
""" | ||
import collections | ||
import re | ||
|
||
n = int(input()) | ||
item_od = collections.OrderedDict() | ||
for i in range(n): | ||
record_list = re.split(r'(\d+)$',input().strip()) | ||
record_list = re.split(r"(\d+)$", input().strip()) | ||
item_name = record_list[0] | ||
item_price = int(record_list[1]) | ||
if item_name not in item_od: | ||
item_od[item_name]=item_price | ||
item_od[item_name] = item_price | ||
else: | ||
item_od[item_name]=item_od[item_name]+item_price | ||
item_od[item_name] = item_od[item_name] + item_price | ||
|
||
for i in item_od: | ||
print(i+str(item_od[i])) | ||
print(i + str(item_od[i])) |
Oops, something went wrong.