INT(Input())和仅输入()有什么区别

发布于 2025-01-27 09:11:18 字数 93 浏览 3 评论 0原文

我是Python的新手,当我使用Input()用于包括数字在内的任何输入时,但我的老师说的是使用INT(Input())用于基于整数的输入。有人可以解释这些语法有什么区别?

I am new to python, and when I use the input() for any inputs including numbers it works, but my teacher is saying to use int(input()) for integer-based inputs. Can someone explain what is the difference between these syntaxes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云淡风轻 2025-02-03 09:11:18

input()返回字符串

要将其更改为一个数字(Integer)do int(),因此它将是int(input())

input() returns a string.

To change it to a number(an integer) do int(), so it would be int(input()).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文