Search Header Logo

青少年软件编程(Python-3)202206

Authored by 子明 高

Information Technology (IT)

7th Grade

Used 3+ times

青少年软件编程(Python-3)202206
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

38 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

如下所示的2行代码,最后print()函数打印出来的结果是?( ) c = [['赵大',21,'男','北京'],['钱二',20,'男','西安'],['孙三',18,'女','南京'],['李四',20,'女','杭州']] print(c[1][3])

北京

西安

2.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

要读取下图“书目.csv”文件的全部内容,小明编写了后面4行代码。请问,红色①处,应该填写哪种打开模式?( ) f = open("书目.csv" , ① ) a = f.read() print(a) f.close

"w"

"a"

"r"

"a+"

3.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

下图所示,有一个名为"书目.csv"的文件。小明针对这个文件编写了5行代码,请问,代码运行到最后打印在屏幕上的结果是?( ) with open('书目.csv', 'r', encoding='utf-8') as f: for line in f.readlines(): a = line.split(",") if a[0] == "水浒传" : print(a[1])

老残游记

172

55

70

4.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

小明编写了下列4行代码,请问,代码运行到最后,屏幕上打印出来的结果是?( ) a = ['a','b','c'] b = [1,2,3] c = [b,a] print(c[1][0])

1

a

'1'

'a'

5.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

下图左边的“身体素质.csv”文件,要打印成下图右边的效果,每个字段之间相隔一个TAB键的距离。小明编写了如下代码,请选择:代码中横线处的内容?( ) f = open('身体素质.csv', 'r') a = [] for i in f: a.append(i.strip('\n').split(',')) f.close for x in a: line='' for y in x: line += '{ } '.format(y) print(line)

\t

\n

\a

\r

6.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

在Python异常处理结构中,如果程序执行没有遇到异常(错误),不会执行什么关键字后面的语句体?( )

try

except

else

finally

7.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

运行下列程序,输出的结果是?( ) try: a=int(input()) b=int(input()) r=a/b print('商是:',r) except: print('错误') else: print('正确') finally: print('结束') 当输入: 16 8

错误

商是: 2.0 正确

商是: 2 正确 结束

商是: 2.0 正确 结束

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?