|
|
- Python 3.14.0 (tags/v3.14.0:ebf955d, Oct 7 2025, 10:15:03) [MSC v.1944 64 bit (AMD64)] on win32
- Enter "help" below or click "Help" above for more information.
- def huang(mei,huilv=7.1)
- SyntaxError: expected ':'
- def huang(mei,huilv=7.1):
- return "你所换得的人民币应该是:"mei*huilv # 不能直接把字符串和变量名放在一起
- SyntaxError: invalid syntax
- def huang(mei,huilv=7.1):
- return "你所换得的人民币应该是:" mei*huilv # 同上
- SyntaxError: invalid syntax
- huang(60) # python 还没认你写的函数
- Traceback (most recent call last):
- File "<pyshell#4>", line 1, in <module>
- huang(60)
- NameError: name 'huang' is not defined
- def exchange(dollar,rate=6.3)
- SyntaxError: expected ':'
- def exchange(dollar,rate=6.3):
- return dollar*rate
- exchange(300) # 这里应该空着表示函数块的结束
- SyntaxError: invalid syntax
- exchange(30) # python 还没认你的函数
- Traceback (most recent call last):
- File "<pyshell#9>", line 1, in <module>
- exchange(30)
- NameError: name 'exchange' is not defined
- def exchange(dollar,rate=6.3):
- return dollar * rate
- exchange(20)
- SyntaxError: invalid syntax
- def shuxue()
- SyntaxError: expected ':'
- def shuxue(a,b):
- return a+b
- shuxue(1,3) # 要空一行
- SyntaxError: invalid syntax
- def shuxue(a,b):
- return a+b
- Shuxue(1,3)
- SyntaxError: invalid syntax
复制代码
求最佳 |
|