1,简单输入输出交互。
input(‘please input your name;‘)
please input your name:hh
‘hh‘
name=input(‘what your name:‘)
what your name:hh
print(‘你好,%s‘%name)
你好,hh
2用户输入两个数字,计算并输出两个数字之和
a=input(‘请输入第一个数:‘)
请输入第一个数:333
b=input(‘请输入第二个数:‘)
请输入第二个数:555
int(a)+int(b)
888
3输入半径,计算圆的面积
r=input(‘r=‘)
r=10
s=3.14*float(r)*float(r)
print(‘圆的面积:%s‘%s)
圆的面积:314.0
原文:http://www.cnblogs.com/honghui/p/7486852.html