python基础练习

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

 

posted @ 2017-09-06 20:41  013洪辉  阅读(111)  评论(0编辑  收藏  举报