题目
题目

2254 BIOSC 1544 SEC1000 Exam #1

单项选择题

What is wrong with this code? def my_func(var):     if var = "the sky":         print("wow.")     elif var = "the ocean":         print("wow.")     else:         print("what?")

选项
A.Syntax error: incorrect use of print statement
B.Incorrect test for equality
C.Indentation error
D.Missing variable declaration
查看解析

查看解析

标准答案
Please login to view
思路分析
We start by restating the given code and the possible issues it might have, so the student can map each option to a concrete problem in the code. Option 1: 'Syntax error: incorrect use of print statement' — In Python 3, print is a function, so the statement print("wow.") is valid syntax. The code has proper parentheses around the string, so this option does not......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!