擅长:python、mysql、java
<p>试试这个:</p>
<pre><code>def getPositiveNumber(prompt):
timeUnits = None
numAtoms = None
radBeaker = None
while True:
timeUnits = input('This is the numnber of time units to simulate > ')
numAtoms = input('How many atoms should we simulate ? ')
radBeaker = input('The radius of the beaker is ? ')
if timeUnits.isnumeric() and numAtoms.isnumeric() and radBeaker.isnumeric():
print 'All your values are integers'
break
return (timeUnits, numAtoms, radBeaker)
</code></pre>