ITPub博客

首页 > IT职业 > IT职场 > 学习python过程中的记录2

学习python过程中的记录2

IT职场 作者:huzhizhong 时间:2021-09-09 09:06:26 0 删除 编辑

第一段代码:

coding:utf-8

def sheshidu(C):
f = C*9/5+32
return (str(f)+'°F')
print sheshidu(100)
结果:
图片描述

第二段代码:

coding:utf-8

def sheshidu(C):
f = C*9/5+32
print (str(f)+'°F')
print sheshidu(100)

结果:
212°F
None

Process finished with exit code 0
出现这种现象的原因:
None是此时返回的值,即什么都没有,因为没有关键字return,
而print打印返回的数值。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1446/viewspace-2799491/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    107
  • 访问量
    921