题解 | #冲击offer的牛牛#

冲击offer的牛牛

https://www.nowcoder.com/practice/c07de1d3c2aa42d0916a1510e529af3e

grade = 88.9
print(type(grade))
print(int(grade))
  1. 在 python 是一种动态类型的语言,所以在申明变量时,不需要声明变量类型
  2. 可以使用 type()这个内置函数来查看变量类型
  3. 在声明变量的时候, 88.9 是小数,python会自动将 grade 变量转换成 float 类型,所以我们使用 int()函数可以将 float 类型变量强制转换成 int 类型
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务