首页 > 其他 > 详细

第一课笔记

时间:2018-06-22 23:22:33      阅读:228      评论:0      收藏:0      [点我收藏+]

首先是讲了python能做什么,python发展历史,python是解释型语言,与其他编译性语言的差异。python的主要解释器。

变量与用户交互

数据类型:数字子,字符(单引号,双引号,三引号的区别),布尔类型

格式化输出

如下为格式化的例子:

name =input("Please input name:")

age = input ("age:")

job = input ("age:")

hometown=input ("hometown:")

info =‘‘‘

------------info of %s------------

name:           %s

age  :            %s

job  :             %s

hometown :  %s

---------------end--------------

‘‘‘ % (name,name,age,job,hometown)

print(info)

 

%s s代表字符串STRING

%d  代表数字 digital

%f 代表浮点数 float

 

 

另外,输入age是什么类型?

print(type(age)),说明input读入的均是字符串。需要进行格式化转换。

age=int(input("name"))

 

第一课笔记

原文:https://www.cnblogs.com/lsl031/p/9215718.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!