擅长:python、mysql、java
<p>我不知道你想做什么,但我想这样可以:</p>
<pre><code>def fallBack(submission):
if (submission == ""):
submission = "fixed!"
return (submission)
name = input("What is your name?")
name = fallBack(name)
location = input("Hi "+name+"! Nice to meet you, I live inside a computer, where do you live?")
</code></pre>
<p>您的两个错误是在没有要修复的情况下不返回任何内容,以及不分配函数返回的值。你知道吗</p>
<p>顺便说一句,在Python中有一种更惯用的方法:</p>
<pre><code>name = input("What is your name?")
name = name or 'fixed!'
location = input("Hi "+name+"! Nice to meet you, I live inside a computer, where do you live?")
</code></pre>
<p>第二行测试是否将<code>name</code>转换为布尔值,如果返回<code>False</code>(对于字符串,相当于测试它是否不是空的),则将其替换为<code>'fixed!'</code></p>