<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anya Yang on Medium]]></title>
        <description><![CDATA[Stories by Anya Yang on Medium]]></description>
        <link>https://medium.com/@free450255?source=rss-70ea21ac6701------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Anya Yang on Medium</title>
            <link>https://medium.com/@free450255?source=rss-70ea21ac6701------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 02:28:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@free450255/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HackerRank-Day01 List]]></title>
            <link>https://medium.com/@free450255/hackerrank-day01-list-d3c6b37af4f0?source=rss-70ea21ac6701------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3c6b37af4f0</guid>
            <category><![CDATA[hackerrank-solution]]></category>
            <dc:creator><![CDATA[Anya Yang]]></dc:creator>
            <pubDate>Wed, 22 Jun 2022 13:24:12 GMT</pubDate>
            <atom:updated>2022-06-22T13:25:21.200Z</atom:updated>
            <content:encoded><![CDATA[<h4>Problem Statement</h4><p>Given the names and grades for each student in a class of students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade.<br><strong>Note:</strong> If there are multiple students with the second lowest grade, order their names alphabetically and print each name on a new line.</p><h4><strong>Example</strong></h4><p><strong>records = [[ “chi”, 20.0]], [“beta”, 50.0], [“alpha”, 50.0]</strong></p><p>The ordered list of scores is <strong>[20.0, 50.0]</strong>, so the second lowest score is <strong>50.0</strong>. There are two students with that score: <strong>[“beta”, “alpha”]</strong>. Ordered alphabetically, the names are printed as:</p><pre>alpha <br>beta</pre><h3>Input Format</h3><p>The first line contains an integer, , the number of students.<br>The subsequent lines describe each student over lines.</p><ul><li>The first line contains a student’s name.</li><li>The second line contains their grade.</li></ul><h4>Constraints</h4><ul><li>2 &lt;= N &lt;= 5</li><li>There will always be one or more students having the second lowest grade.</li></ul><h3>Output Format</h3><p>Print the name(s) of any student(s) having the second lowest grade in. If there are multiple students, order their names alphabetically and print each one on a new line.</p><p><strong>Sample Input 0</strong></p><pre>5<br>Harry<br>37.21<br>Berry<br>37.21<br>Tina<br>37.2<br>Akriti<br>41<br>Harsh<br>39</pre><p><strong>Sample Output 0</strong></p><pre>Berry<br>Harry</pre><p><strong>Explanation 0</strong></p><p>There are students in this class whose names and grades are assembled to build the following list:</p><p>python students = [[&#39;Harry&#39;, 37.21], [&#39;Berry&#39;, 37.21], [&#39;Tina&#39;, 37.2], [&#39;Akriti&#39;, 41], [&#39;Harsh&#39;, 39]]</p><p>The lowest grade of 37.2 belongs to Tina. The second lowest grade of 37.2 belongs to both Harry and Berry, so we order their names alphabetically and print each name on a new line.</p><h3>My Solution</h3><pre>if __name__ == &#39;__main__&#39;:<br>a = []<br>goal = []<br>for _ in range(int(input())):<br>    name = input()<br>    score = float(input())<br>    a.append([name, score])<br>    goal.append(score)</pre><pre>c = list(set(goal))<br>c.sort()<br>a.sort()</pre><pre>for (x,y) in a:<br>    if y==c[1]:<br>        print(x)</pre><h4>Error</h4><ul><li>set():無法直接取出值，會TypeError</li></ul><pre>TypeError                      Traceback (most recent call last)</pre><pre>&lt;ipython-input-9-15aef1b45a99&gt; in &lt;module&gt;</pre><pre>----&gt; 1 b[1]</pre><pre>TypeError: &#39;set&#39; object is not subscriptable</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3c6b37af4f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>