PYTHON 1:
程序输出
1:
myString =‘Hello,Word!’
print myString
Hello,Word!
myString
‘Hello Word!’
2:
print("%s is number %d! % (“python”,1))
python is number 1!
%s 替换字符串 %d替换整型 %f替换浮点型
3:
a=int(input(“小明的成绩为:”))
小明的成绩为:89
print(‘小明的成绩为:%d’ %(a)2)
小明的成绩为:178
4:
2<4
True
24
False
2>4
False
6.2<=6
False
6.2<=6.2
True
2<4 and 24
False
2>4 or 2<4
True
not 6.2<=6
True
4:
pystr=‘python’
iscool=‘is cool’
pystr[0]
‘p’
pystr[2:5]
‘tho’
iscool[3:]
‘cool’
iscool[-1]
‘l’
pystr+iscool
‘pythonis cool’
pystr+’’+iscool
‘python is cool’
pystr2
‘pythonpython’
‘-’*20
‘___________________’
pystr=’’‘python
is cool’’’
pystr
‘python\nis cool’
print pystr
python
is cool
5:
a=‘hcjhcj’
k in a
False
c in a
True