Skip to content

Commit 353ea3b

Browse files
committed
update
1 parent c9da526 commit 353ea3b

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

python/10_nested-list.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if __name__ == '__main__':
2+
python_students = []
3+
for i in range(int(input())):
4+
name = input()
5+
score = float(input())
6+
python_students.append([name, score])
7+
8+
second_postion = sorted(set(s for n,s in python_students))[1]
9+
print('\n'.join(sorted(n for n,s in python_students if s == second_postion)))

python/11_finding-the-percentage.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
if __name__ == '__main__':
2+
n = int(input())
3+
student_marks = {}
4+
for _ in range(n):
5+
name, *line = input().split()
6+
scores = list(map(float, line))
7+
student_marks[name] = scores
8+
query_name = input()
9+
for name in student_marks:
10+
if name == query_name:
11+
avg = student_marks[name]
12+
average = sum(avg) / len(avg)
13+
print(f"{average:.2f}")

python/12_python-lists.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
if __name__ == '__main__':
2+
N = int(input())
3+
List = [];
4+
for i in range(N):
5+
qurey = input().split();
6+
if qurey[0] == 'insert':
7+
List.insert(int(qurey[1]), int(qurey[2]))
8+
elif qurey[0] == 'remove':
9+
List.remove(int(qurey[1]))
10+
elif qurey[0] == 'append':
11+
List.append(int(qurey[1]))
12+
elif qurey[0] == 'print':
13+
print(List)
14+
elif qurey[0] == 'sort':
15+
List.sort();
16+
elif qurey[0] == 'pop':
17+
List.pop();
18+
elif qurey[0] == 'reverse':
19+
List.reverse();
File renamed without changes.

0 commit comments

Comments
 (0)