We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Collections.namedtuple()
Collections.namedtuple()
Sort by
recency
|
1052 Discussions
|
Please Login in order to post a comment
n = int(input())
from collections import namedtuple students = namedtuple('students', input())
sum_notes = 0 for counter in range(n): x, y, z, w = input().split() st = students(x, y, z, w) sum_notes += int(st.MARKS)
avg_notes = (sum_notes/n) print(f"{avg_notes:.2f}")
What is healthhubin.com? The platform is dedicated to providing health information. The platform’s content covers wellness practices, helping readers implement positive changes. For more info, click this link https://healthhubin.com/. Its commitment to accuracy ensures that visitors receive guidance for a healthy life.
from collections import namedtuple
n = int(input())
Stu = namedtuple('Student', input())
print(sum(int(Stu._make(input().split()).MARKS) for _ in range(n)) / n)
Stu._make(...): The _make method is called on the Stu named tuple, which takes the list of strings and creates a Student instance. For our example, if input is Alice 80, it creates Student(NAME='Alice', MARKS='80').