擅长:python、mysql、java
<p>正如您所猜测的,您只需正常地添加它们,并在列表中转换它们之后对其应用<code>sorted</code>。<code>sorted</code>默认情况下按升序排序</p>
<pre><code># initialize lists at the top of your code,
l1 = []
l2 = []
</code></pre>
<p>然后你可以在每次迭代中附加到两个列表中</p>
<p>替换</p>
<pre><code>x = R*(v*n)
if x/s<100:
print("meridian will be", x/s, "cm from center")
</code></pre>
<p>用</p>
<pre><code>x = R*(v*n)
if x/s<100:
l1.append(x/s)
</code></pre>
<p>对<code>x2</code>也这样做</p>
<p>最后创建一个排序列表</p>
<pre><code>sorted_list = sorted(l1 + l2)
</code></pre>
<p>打印排序列表</p>
<pre><code>for i in sorted_list:
print("meridan will be {}".format(i))
</code></pre>