Python学习【第2篇】:基本数据类型

基本数据类型

字符串 ---------n1 = "xiaoxing"   n2 = "admin"  n3 = "123"  n4 = "soft"

数字-----------age = 21   weight = 64 fight = 20

加减乘除等:

字符串:

      加法:

n1 = "xiaoxing1"
n2 = "smart"
n4 = "ceshi"
n3 = n1 + n2 + n4
print (n3)
运行结果:xiaoxing1smartceshi 

      乘法:

n1 = "xiaoxing1"
n3 = n1*5
print(n3)
运行结果;xiaoxing1xiaoxing1xiaoxing1xiaoxing1xiaoxing1

数字:

n1 = 10
n2 = 2
n3 = n1 + n2
n3 = n1 - n2
n3 = n1 * n2
n3 = n1 / n2

 

posted on 2018-05-05 15:14  小星1995  阅读(202)  评论(0编辑  收藏  举报

导航