Fork me on GitHub
'''
level=11
print(type(level))
'''
'''
num=12
print(type(num))
'''
'''
sum=int(13)
print(type(sum))
'''
'''
age=int(18)
print(age,type(age),id(age))
'''
'''
状态:薪资,身高,体重
浮点型:float float float
'''
# slary=100000.1
# print(slary,type(slary),id(slary))
# slary=float(100000.1)
# print(slary,type(slary),id(slary))
# ctrl+左斜杠(问号键)
# 字符串,在引号(单引号,双引号,三引号)里定义的一堆字符
# 状态:描述性的内容,性别,国籍,姓名,高低
# gender='male'
# print(gender,type(gender),id(gender))
#双引号
# information="my name is Rambo,i'm a OBOS"
# print('informstion',type(information),id(information))
#三引号
# cmd='''
# x=1
# y=1
# q=1
# '''
# print(cmd)
# cmd='''
# gender='male'
# information="my name is Rambo,i'm a OBOS"
# slary=100000.1
# '''
# print(cmd)
# x=1
# c=2
# print(x+c)
# print(x*c)
# print(x%c)
# x=1
# c=2.3
# print(x+c)
# print(x*c)
# print(x%c)
#字符串只能跟字符串之间加或者乘
#不是简单的cmd1和cmd2的两个空间加起来,而是新开了一个空间作为cmd
# cmd1='he '#(加了一个空格)
# cmd2='lan bo'
# cmd=cmd1+cmd2
# print(cmd)
# cmd='''
# -
# .
# /
# '''
# print(cmd*10)
# print('-'*20)
# print('Rambo,who is the winner!')
# print('*'*20)
# 列表类型:在中括号【】内存放任意个用逗号隔开的任意类型字符
# 状态:有序存放多个值
# list=['name=Rambo','age=18','gender=male',['OBOS',1000000000.1,'beijing']]
# print(list)
# print(list[0])
# print(list[3][0])
# 字典类型:在大括号{}内存放任意个用逗号隔开的key:value,value可以是任意类型字符,但是key必须是不变的类型
# 状态:无序存放多个值 python3的字典可能做了改动,字典做成了有序
# list=['name=Rambo','age=18','gender=male',['OBOS',1000000000.1,'beijing']]
# dictionary={
# 'name':'Rambo',
# 'age':18,
# 'gender':'male',
# 'company':['OBOS',1000000000.1,'beijing']
# }
# print(dictionary['name'])
# dictionary={
# 'name':'Rambo',
# 'age':18,
# 'gender':'male',
# 'company':{'name':'OBOS','count':1000000000,'adress':'beijing'}
# }
# print(dictionary['company']['count'])
# 布尔类型:True,False
# 状态:
# print(type(True))
# cmd=20
# print(cmd>18)

# 可变类型和不可变类型,字典的key是不可变类型

###id不变的情况下value可以改变
# 不可变int,float,str

###value一旦改变,id肯定改变
# 可变:列表,字典

# dictionary={1:'a'}
# print(dictionary[1])
posted on 2019-11-20 22:05  OBOS  阅读(191)  评论(0编辑  收藏  举报