语法:Python中的语法无效?
我最近通过观看CS50课程开始学习编程。我目前正在介绍Python。一切都是根据我的视频课程完成的。通过编写简单的代码,我会发现一个与讲师不同的问题。
这是:
answer = input("What's your name?")
print(f"hello, {answer}")
我得到的问题:
File "hi.py", line 2
print(f"hello, {answer}")
^
SyntaxError: invalid syntax
我将对您的回答表示真诚的感谢!
I have recently started learning programming by watching CS50 course. I am currently on the introduction of Python. Everything was done by me in accordance to that video-course. By writing simple code I get an issue unlike my lecturer does.
Here it is:
answer = input("What's your name?")
print(f"hello, {answer}")
Issue I have got:
File "hi.py", line 2
print(f"hello, {answer}")
^
SyntaxError: invalid syntax
I would be sincerely grateful for your answer!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您好,您无法在变量中使用打印功能
因此,写这篇文章的正确方法是
hello you can't use the print function in the Variable
so the right way to write this is