CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day02/variable5.py
Views: 729
1
"""
2
类型转换
3
4
Version: 0.1
5
Author: 骆昊
6
Date: 2018-02-27
7
"""
8
9
a = 100
10
b = str(a)
11
c = 12.345
12
d = str(c)
13
e = '123'
14
f = int(e)
15
g = '123.456'
16
h = float(g)
17
i = False
18
j = str(i)
19
k = 'hello'
20
m = bool(k)
21
print(a)
22
print(type(a))
23
print(b)
24
print(type(b))
25
print(c)
26
print(type(c))
27
print(d)
28
print(type(d))
29
print(e)
30
print(type(e))
31
print(f)
32
print(type(f))
33
print(g)
34
print(type(g))
35
print(h)
36
print(type(h))
37
print(i)
38
print(type(i))
39
print(j)
40
print(type(j))
41
print(k)
42
print(type(k))
43
print(m)
44
print(type(m))
45
46