Skip to content

Commit 9531d95

Browse files
committed
updated set solutions
1 parent 3a4204d commit 9531d95

27 files changed

+187
-162
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'''
1+
"""
22
Title : Finding the percentage
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/finding-the-percentage/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
n = int(input())
1111
student_marks = {}
@@ -14,5 +14,5 @@
1414
scores = list(map(float, line))
1515
student_marks[name] = scores
1616
query_name = input()
17-
res = sum(student_marks[query_name])/len(student_marks[name])
18-
print("{:.2f}".format(res))
17+
res = sum(student_marks[query_name]) / len(student_marks[name])
18+
print("{:.2f}".format(res))

BasicDataTypes/FindtheSecondLargestNumber.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'''
1+
"""
22
Title : Find the Runner-Up Score!
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
77
Problem : https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
n = int(input())
1111
arr = map(int, input().split())

BasicDataTypes/ListComprehensions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
'''
1+
"""
22
Title : List Comprehensions
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/list-comprehensions/problem
8-
'''
8+
"""
99
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) for k in range(z+1) if i+j+k!=n]
15-
print(ar)
14+
ar = [[i, j, k] for i in range(x + 1) for j in range(y + 1) for k in
15+
range(z + 1) if i + j + k != n]
16+
print(ar)

BasicDataTypes/Lists.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'''
1+
"""
22
Title : Lists
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/python-lists/problem
8-
'''
8+
"""
99

1010
if __name__ == '__main__':
1111
N = int(input())

BasicDataTypes/NestedLists.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'''
1+
"""
22
Title : Nested Lists
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/nested-list/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
students = []
1111
scores = []
@@ -16,5 +16,6 @@
1616
students.append(student)
1717
scores.append(score)
1818
second_min_score = sorted(set(scores))[1]
19-
filtered_student_names = sorted([student[0] for student in students if student[1] == second_min_score])
20-
print("\n".join(filtered_student_names))
19+
student_names = sorted(
20+
[student[0] for student in students if student[1] == second_min_score])
21+
print("\n".join(student_names))

BasicDataTypes/Tuples.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
'''
1+
"""
22
Title : Tuples
33
Subdomain : Data Types
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/python-tuples/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
n = int(input())
1111
integer_list = map(int, input().split())
1212
t = tuple(integer_list)
13-
print(hash(t))
13+
print(hash(t))

Introduction/ArithmeticOperators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
'''
1+
"""
22
Title : Arithmetic Operators
33
Subdomain : Introduction
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 April 2020
77
Problem : https://www.hackerrank.com/challenges/python-arithmetic-operators/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
a = int(input())
1111
b = int(input())
12-
print(a+b)
13-
print(a-b)
14-
print(a*b)
12+
print(a + b)
13+
print(a - b)
14+
print(a * b)

Introduction/Loops.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
'''
1+
"""
22
Title : Loops
33
Subdomain : Introduction
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 13 May 2020
77
Problem : https://www.hackerrank.com/challenges/python-loops/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
n = int(input())
1111
for i in range(n):
12-
print(i*i)
13-
12+
print(i * i)

Introduction/PrintFunction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
'''
1+
"""
22
Title : Print Function
33
Subdomain : Introduction
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/python-print/problem
8-
'''
8+
"""
99

1010
if __name__ == '__main__':
1111
n = int(input())
12-
ar=range(1,n+1)
12+
ar = range(1, n + 1)
1313
for i in ar:
14-
print(i,end="")
14+
print(i, end="")
1515

1616
"""
1717
Alternate solution:

Introduction/PythonDivision.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
'''
1+
"""
22
Title : Python: Division
33
Subdomain : Introduction
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 06 July 2020
77
Problem : https://www.hackerrank.com/challenges/python-division/problem
8-
'''
8+
"""
99
if __name__ == '__main__':
1010
a = int(input())
1111
b = int(input())
12-
print(a//b)
13-
print(a/b)
14-
12+
print(a // b)
13+
print(a / b)

0 commit comments

Comments
 (0)