擅长:python、mysql、java
<p>这样就可以了。它按下列表中所有的有效电阻,当一个特定数量的有效电阻在里面时,它就会断开。你知道吗</p>
<pre><code>resistors = []
while len(resistors) < 7:
try:
R = float(input( 'Resistor Value R: ' ))
except ValueError:
print( 'Sorry, Invalid Input! Try Inputing A Number' )
continue
if R < 0 :
print( 'Sorry, Invalid Input! Try A Positive Number ' )
continue
else:
resistors.append(R)
</code></pre>