StudyPilot
关于博客价格常见问题联系隐私条款

© 2026 StudyPilot. 保留所有权利。

题库COMP9001COMP9001 Week 5 每周题库 · Functions 函数、作用域与返回值

COMP9001 Week 5 每周题库 · Functions 函数、作用域与返回值

Week 5 精选练习:函数定义、参数、作用域、返回值与引用。Curated practice on functions, scope, return values and references.

0题目
0已练习
0%你的正确率
~0 分钟预计时间
W05 Functions 函数基础

What is the value of count after the following code is run?count = 0 for x in 'Hello World': if x == 'l' or x == 'o': count += 1

W05 Functions 函数基础

Consider the function foo defined below. What type of value does foo return?def foo(n: int): """Precondition: n > 0""" total = 0 for i in range(n): total += i print(total)

W05 Scope 变量作用域

What error (if any) will the following code produce?def greet(name): global name return 'Hello, ' + name greet('Alice')

W05 Scope 变量作用域

What is the value of x after the following code is executed?x = 10 def foo(y): x = y + 5 return x foo(3)

W05 Scope 变量作用域

What error (if any) will the following code produce when executed by Python?

你的进度

0%0 / 40

已练 0 / 40 · 正确率 0%

升级解锁
StudyPilot
题库价格日历
登录