LearnPy Hub
← Inheritance & Special Methods problems
Medium

Dataclass

Use @dataclass to make Student(name: str, cgpa: float). Read n students and print the dataclass repr of the student with the highest cgpa (first if tied).

Input

n, then n lines 'name cgpa'.

Output

A repr.

Sample 1

Input
3
Mim 3.8
Rafi 3.9
Sara 3.9
Output
Student(name='Rafi', cgpa=3.9)

Sample 2

Input
1
A 4.0
Output
Student(name='A', cgpa=4.0)
solution.py
Output appears here
Dataclass · Python practice problem · LearnPy Hub