-
hackerrank.com Practice>Python>Collections>Collections.namedtuple()hackerrank.com 2019. 2. 11. 13:26728x90
collections.namedtuple()
Problem link : https://www.hackerrank.com/challenges/py-collections-namedtuple/problemDifficulty : EasyTip
- 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'hackerrank.com' 카테고리의 다른 글
Practice>Python>Sets>Introduction to Sets (0) 2019.02.13 Practice>Python>Math>Polar Coordinates (0) 2019.02.12 hackerrank.com Practice>Python>Collections>DefaultDict Tutorial (0) 2019.02.10 hackerrank.com Practice>Python>Itertools>Compress the String! (0) 2019.02.07 hackerrank.com Practice>Python>Sets>No Idea! (0) 2019.02.06