第12课 Python的函数 知识点题库

Python 中,用于获取用户输入的命令是(    )。
A . input B . read C . get D . For
下面程序运行的结果是(    )

i=1

sum=0

while i<=20:

    if I %2==0:

        sum=sum-i

    else:

        sum=sum+i

    i +=1

print (sum)

A . 1 B . 6 C . -5 D . -10
执行下边的程序,输出运行结果是(    )

图片_x0020_100001

A . 6.5 B . 6.0 C . 5 D . 6
以下打印结果的类型不为字符串的是:(    )
A . a=input('输入一个数字: ')
print(a)
B . x=8
y=str(x)
print(y)
C . x='8'
y=int(x)
print(y)
D . print('8')
 查看变量类型的 Python 内置函数是
在python中运行以下程序,运行结果是(      )

print("3+6")

A . "3+6" B . 3+6 C .   9 D . 36
在range( )函数中最少使用的参数和最多使用参数个数分别为(    )。
A . 0,1 B . 1,2 C . 1,3 D . 2,3
Python中,用于获取用户输入的命令是(     )。           
A . Input B . Read C . Get D . For
能生成一个大于等于10 且小于100的随机整数的表达式(random模块已经导入)是(     )
A . int( random( ) * 100 ) B . randint( 10, 100 ) C . int( random( ) * 99 + 10 ) D . randint( 10, 99 )
在 Python 中,range(100)生成的序列是()
A . 0 至 100 B . 0 至 99 C . 1 至 99 D . 1 至 99
写出range(1,5)的计数范围(    )
A . 1,2,3,4 B . 1,2,3,4,5 C . 1,3,5 D . 2,4
range(5)表示的范围是多少()
A . 1 2 3 4 5 B . 0 1 2 3 4 C . 5 D . 1 5
编写程序,计算圆的周长、面积。假设圆的半径是r,圆的周长是C,圆的面积是S,π用3.14代替。要求圆的半径从键盘输入,用input()命令。
编程求长方形面积。要求在程序运行的时候从键盘输入长方形的长和宽。假设长方形的长用变量a表示,宽用变量b表示,面积用变量S表示。
请写出下面程序的运行结果:

sum=0

for i in range(1,11,1) :

  sum=sum+i

print( sum)

有如下Python程序。

def add(x,y)/:     #定义一个函数,x,y是参数

t=x+y

return t       #将结果返回,函数结束

print(add(6,9))

程序运行之后结果是

写出运行结果

>>> print("hello","Python World!")

>>> print("hello","Python World!",sep='')

>>> print("hello","Python World!",sep=' ')

>>> print("hello","Python World!",sep=',')

python使用(   )函数接收用户输入的数据。
A . input( ) B . int( ) C . float( ) D . readline( )
执行下列语句后的结果是(   )

world="world"

print("hello"+world)

A . 语法错误 B . hello world C . helloworld D . "hello"world?