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

  1. Key point is that we shoiuld use namedtuple() to access MARKS while the position of MARKS column is changed
  2. columns can be used as the names of namedtuple()
    1. columns = input() // ID MARKS NAME CLASS
    2. Student = namedtuple('Student', columns)
  3. Initialize Student from input()
    1. s = Student(*input().split())
      sumMarks += int(s.MARKS)

Solution



728x90