<p>所以我今天才开始学Python。尝试了一个basic程序,但收到一个错误“cannot convert int object to str implicity”</p>
<pre><code>userName = input('Please enter your name: ' )
age = input('Please enter your age: ')
factor = 2
finalAge = age + factor **ERRORS OUT ON THIS LINE**
multAge = age * factor
divAge = age / factor
print('In', factor, 'years you will be', finalAge, 'years old', userName )
print('Your age multiplied by', factor, 'is', multAge )
print('Your age divided by', factor, 'is', divAge )
</code></pre>
<p>当我输入int(age)+factor,而不是age时,它就完美地工作了。但是作者说python在输入变量类型时会自动检测它。所以在这种情况下,当我输入age=20时,那么age应该自动变成整数,对吗?在</p>
<p>期待任何帮助!!在</p>