hackerrank.com
hackerrank.com Practice>Python>Collections>Collections.namedtuple()
건이두
2019. 2. 11. 13:26
728x90
collections.namedtuple()
Problem link : https://www.hackerrank.com/challenges/py-collections-namedtuple/problem
Difficulty : Easy
Tip
- Key point is that we shoiuld use namedtuple() to access MARKS while the position of MARKS column is changed
- columns can be used as the names of namedtuple()
- columns = input() // ID MARKS NAME CLASS
- Student = namedtuple('Student', columns)
- Initialize Student from input()
- s = Student(*input().split())sumMarks += int(s.MARKS)
Solution
728x90