首先是讲了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