十分抱歉,由于网站上传照片需要压缩,没想到压缩成了碎碎,让大家难以分辨。这两天忙着去上课啦,回来一看信息炸锅~现重新整理文本形式,之后再追加的酬金,谢谢大家啦!请大家点击Google doc,please,因为还是有图片,无法纯文字。
- The purpose of this code is to print "user flagged" if the username is "jhill", and otherwise to print "user okay". Run this code, analyze its output, and debug it. (If you want to undo your changes to the code, you can click the Reset button.)
How can you fix this error?
a. Use the != operator instead of the == operator in the conditional header.
b. Add an else statement before the line that prints "user okay".
c. Remove indentation from the line that prints "user okay" so that it is not part of the conditional.
d. Call check_user() before the function definition.
You did not assign a value to a variable before using it in a conditional statement. What type of error is this?
a. Syntax error
b. Exception
c. Index out of bounds
d. Logic errorWhen debugging code, what are effective ways to determine which sections of code are working properly? Select all that apply.
o Use a debugger
o Add comments in the code
o Add print statements
o Delete blank lines from the code
- You want to check for unusual login activity. Specifically, you want to read a log file that contains information on each login attempt, including whether it failed or was successful. You should then parse the data into a logins list, and then you should separate all failed log entries into a separate failed_logins list. If you want to automate this through Python, what would be part of your code? Select three answers.
o A for loop to iterate through all items in the logins list
o An if statement to check if a login attempt failed
o A counter variable to keep track of the number of failed logins
o A split() function to split the login information into a list
关于Python, Linux and SQL错误习题,请大家帮助解答!感谢!