你好,我是悦创。
1. 数据类型有哪些?
| 数据类型 | 关键词 | 单词 |
|---|---|---|
| 布尔型:True、False | bool() | boolean |
| 数字型:int:1, 2, 3、float: 1.0, 2.0 | int()、float() | integer |
| 字符串:’lilei’、”hanmeimei”、“”“aiyc”“” | str() | String |
| 元组:(1, 2, 3, 4, 5, 6) | tuple() | tuple |
| 字典:{key:value} | dict() | dictionary |
| 集合:{1, 2, 3, 4, 5, 6, 7, 8, 9} | set() | set |
| 列表:[1, 2, 3, 4, 5, 6] | list() | list |
a = 1print(type(a))a = 1.0type_result = type(a)print(type_result)x = 1y = 2sum = x + y# res = 100 + sumprint(100 + sum)# sum = x + y# print(x + y)# print(100 + x + y)# 如果结果在接下来的代码中会使用到,我就创建变量赋值,使用不到可以不赋值!str1 = 'hello aiyc'str2 = "hello aiyc"str3 = """hello aiyc"""print(str1)print(str2)print(str3)# control + shift + R# control + shift + Fn + F10
