Skip to content

Commit 18467c8

Browse files
authored
Merge pull request #51 from HighnessAtharva/master
imports sorted and code formatted
2 parents c462100 + c30fda0 commit 18467c8

File tree

95 files changed

+605
-475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+605
-475
lines changed

BasicDataTypes/Findingthepercentage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Updated : 06 February 2023
88
Problem : https://www.hackerrank.com/challenges/finding-the-percentage/problem
99
"""
10-
if __name__ == '__main__':
10+
if __name__ == "__main__":
1111
n = int(input())
1212
student_marks = {}
1313
for _ in range(n):
@@ -17,4 +17,3 @@
1717
query_name = input()
1818
avg_score = sum(student_marks[query_name]) / len(student_marks[query_name])
1919
print(f"{avg_score:.2f}")
20-

BasicDataTypes/FindtheSecondLargestNumber.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Created : 15 July 2016
77
Problem : https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
88
"""
9-
if __name__ == '__main__':
9+
if __name__ == "__main__":
1010
n = int(input())
1111
arr = map(int, input().split())
1212
print(sorted(set(arr), reverse=True)[1])

BasicDataTypes/ListComprehensions.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/list-comprehensions/problem
88
"""
9-
if __name__ == '__main__':
9+
if __name__ == "__main__":
1010
x = int(input())
1111
y = int(input())
1212
z = int(input())
1313
n = int(input())
14-
ar = [[i, j, k] for i in range(x + 1) for j in range(y + 1)
15-
for k in range(z + 1) if i + j + k != n]
14+
ar = [
15+
[i, j, k]
16+
for i in range(x + 1)
17+
for j in range(y + 1)
18+
for k in range(z + 1)
19+
if i + j + k != n
20+
]
1621
print(ar)

BasicDataTypes/Lists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Problem : https://www.hackerrank.com/challenges/python-lists/problem
99
"""
1010

11-
if __name__ == '__main__':
11+
if __name__ == "__main__":
1212
N = int(input())
1313
ar = []
1414
for i in range(N):

BasicDataTypes/NestedLists.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/nested-list/problem
88
"""
9-
if __name__ == '__main__':
9+
if __name__ == "__main__":
1010
students = []
1111
scores = []
1212
for _ in range(int(input())):
@@ -16,6 +16,7 @@
1616
students.append(student)
1717
scores.append(score)
1818
second_min_score = sorted(set(scores))[1]
19-
student_names = sorted([student[0] for student in students
20-
if student[1] == second_min_score])
19+
student_names = sorted(
20+
[student[0] for student in students if student[1] == second_min_score]
21+
)
2122
print("\n".join(student_names))

BasicDataTypes/Tuples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/python-tuples/problem
88
"""
9-
if __name__ == '__main__':
9+
if __name__ == "__main__":
1010
n = int(input())
1111
integer_list = map(int, input().split())
1212
t = tuple(integer_list)

BuiltIns/AnyorAll.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''
1+
"""
22
Title : Any or All
33
Subdomain : Built-Ins
44
Domain : Python
@@ -7,7 +7,7 @@
77
Created : 15 July 2016
88
Updated : 29 August 2022
99
Problem : https://www.hackerrank.com/challenges/any-or-all/problem
10-
'''
10+
"""
1111
n = input()
1212
ar = input().split()
13-
print(all([int(i)>0 for i in ar]) and any([i==i[::-1] for i in ar]))
13+
print(all([int(i) > 0 for i in ar]) and any([i == i[::-1] for i in ar]))

BuiltIns/AthleteSort.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''
1+
"""
22
Title : Athlete Sort
33
Subdomain : Built-Ins
44
Domain : Python
@@ -7,17 +7,17 @@
77
Created : 3 April 2021
88
Updated : 30 August 2022
99
Problem : https://www.hackerrank.com/challenges/python-sort-sort/problem
10-
'''
10+
"""
1111

12-
if __name__ == '__main__':
12+
if __name__ == "__main__":
1313
n, m = map(int, input().split())
1414

1515
arr = []
1616

1717
for _ in range(n):
1818
arr.append(list(map(int, input().rstrip().split())))
19-
19+
2020
k = int(input())
21-
22-
for i in sorted(arr, key= lambda x: x[k]):
21+
22+
for i in sorted(arr, key=lambda x: x[k]):
2323
print(*i)

BuiltIns/Input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
'''
1+
"""
22
Title : Input()
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
77
Updated : 3 April 2021
88
Problem : https://www.hackerrank.com/challenges/input/problem
9-
'''
9+
"""
1010

1111
if __name__ == "__main__":
1212
x, k = map(int, input().strip().split())

BuiltIns/PythonEvaluation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
'''
1+
"""
22
Title : Python Evaluation
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
77
Problem : https://www.hackerrank.com/challenges/python-eval/problem
8-
'''
8+
"""
99
eval(input())

0 commit comments

Comments
 (0)