WorksheetsPython lesson 1 to 5 编程测验
Total questions: 79
Worksheet time: 40mins
Python 是什么类型的编程语言?
汇编语言
机器语言
低级编程语言
高级编程语言
Python 的开发者是谁?
Linus Torvalds
Bjarne Stroustrup
Guido van Rossum
James Gosling
以下哪个是 Python 的特点?
复杂难学
收费软件
不支持社区
跨平台运行
Python 可以用于哪些领域?
网站开发
以上所有
数据分析
人工智能
如何在 Python 中输出字符串?
output('Hello')
echo 'Hello'
print('Hello')
write('Hello')
在 Python 中,字符串必须放在什么符号里?
大括号
方括号
括号
引号
以下哪个是有效的 Python 输出语句?
print('Hello)
print(Hello')
print('Hello')
print(Hello)
在 Python 中,如何表示换行?
\r
\t
\b
\n
Python 中的整数类型用什么表示?
int
float
str
bool
Python 中的浮点数用什么表示?
float
list
str
int
在 Python 中,布尔值的两个可能值是什么?
True 和 False
1 和 0
是 和 否
高 和 低
Python 中的列表 list 用什么符号表示?
{}
()
[]
<>
Python 中的字典 dictionary 用什么符号表示?
{}
[]
()
<>
在 Python 中,如何查看变量的类型?
checktype()
var_type()
type()
typeof()
在 Python 中,如何将字符串转换为整数?
int()
str()
float()
bool()
在 Python 中,如何使用 f-string 格式化字符串?
print(f'Hello')
print(f'Hello)
print('Hello')
print(Hello')
Python 中的运算符优先级从高到低的顺序是什么?
() > + - > * / > **
+ - > * / > ** > ()
** > * / > + - > ()
() > ** > * / > + -
在 Python 中,if 语句的基本结构是什么?
if condition:
if condition {}
if (condition) {}
if condition;
在 Python 中,else 语句的作用是什么?
处理异常
处理循环
处理条件成立的情况
处理其他情况
在 Python 中,elif 语句的作用是什么?
处理多个条件
处理单一条件
处理异常
处理循环
在 Python 中,如何判断一个数字是否为偶数?
if num % 2 == 0:
if num / 2 == 0:
if num % 2 != 0:
if num // 2 == 0:
在 Python 中,如何让用户输入信息?
read()
input()
scan()
get()
在 Python 中,如何将用户输入的字符串转换为整数?
int(input())
str(input())
float(input())
bool(input())
在 Python 中,如何使用逻辑运算符 and?
if a and b:
if a && b:
if a & b:
if a and b;
在 Python 中,如何使用逻辑运算符 or?
if a || b:
if a | b:
if a or b;
if a or b:
在 Python 中,如何使用逻辑运算符 not?
if not a:
if not a;
if !a:
if ~a:
在 Python 中,如何处理嵌套条件判断?
在 else 内再写 if
在 if 内再写 if
在 elif 内再写 if
以上都对
在 Python 中,如何使用 pass 占位?
if condition:
if (condition) pass
if condition: pass
if condition; pass
x = 10
if x > 5:
print("A")
if x > 8:
print("B")
else:
print("C")
这段代码的输出是什么?
A B
A C
B C
A B C
pass语句的目的是什么?
终止程序
跳过当前迭代
作为空代码块的占位符
打印消息
(3 + 2) * 4 > 15 or not False的结果是什么?
True
False
错误
None
name = input("你叫什么名字? ")
print("你好", name),
如果用户输入"Ali":
你好. Ali
name
取余数
if x > 5
print('大')
缺少什么?
age = 15
if age >= 18:
print('成人')
else:
print('未成年人')
输出?
score = 75
if score >= 80:
print('优秀')
elif score >= 60:
print('及格')
else:
print('不及格')
输出?
x = 5
if x > 3:
pass
else:
print('x <= 3')
输出?
if x = 5:
print('五')
有什么问题?
age = 16
if age >= 13 and age < 18:
print('青少年')
输出?
x = 5
if x > 0:
if x > 3:
print('大')
else:
print('小')
else:
print('负数')
输出?
age = int(input('输入年龄:'))
if age >= 18:
print('欢迎')
else:
print('不允许')
若输入16 输出?
x = 5
if not x > 10:
print('OK')
输出?
