x1=10
x2=10.0
print(x1,x2)
10 10.0
print(type(x1),type(x2))
<class 'int'> <class 'float'>
x3='hello world'
x4="hehe"
x5='''a
b
c
'''
print(x3,x4,x5)
hello world hehe a
b
c
a=True
b=False
print(a==1)
print(b==0)
print(2>3)
True
True
False
lst=[1,2,3,4,5]
print(lst,type(lst))
lst2=[1,2,5,'hello',[1,2,3]]
print(lst2[4],type(lst2[4]))
[1, 2, 3, 4, 5] <class 'list'>
[1, 2, 3] <class 'list'>
tup = (1,2,3,4,5)
lst = [1,2,3,4,5]
lst[0]=100
print(lst)
[100, 2, 3, 4, 5]
dic={'a':100,'b':'hello'}
print(dic,type(dic))
{'a': 100, 'b': 'hello'} <class 'dict'>
var1=10
print(type(var1))
var2=float(var1)
print(var2,type(var2))
var3=str(var1)
print(var3,type(var3))
var4=100.456
print(int(var4))
<class 'int'>
10.0 <class 'float'>
10 <class 'str'>
100
'''
变量命名规则:
1. 变量名第一个字符必须是字母(大小写均可)或者下划线,不能数字开头
2. 变量名不能和常用功能性名字重合,例如print,if,for
3. 不要有空格
'''
a=b=c=1
d,e,f=1,2,'hello'
print(a,b,c,d,e,f)
1 1 1 1 2 hello