Consider the code fragment (assumed to be in a program in which all variables ar
ID: 3915660 • Letter: C
Question
Consider the code fragment (assumed to be in a program in which all variables are legally defined) # when integer mAge is between 10-15, inclusive, increment the counter if not (myAge10 or myAge 15): counter1 According to 1. the rules of Python 2. the use of logical and relational expressions, and 3. the published style rules for this course, this program has the following number and types of errors: Two style errors, one compiler error and no logic errors O Two style errors and no compiler or logic errors. O No style, logic or compiler errors. One style error, one logic error and no compiler errors. One style error, one logic error and one compiler error One style error, two compiler errors and one logic errorExplanation / Answer
Q1.
option 5: one style error, one logic error and one compile error
logic error is that the condition should be if not (myAge < 10 or myAge > 15): i.e. the = sign has to be removed
compiler error because of indentation not correct. the line counter += 1 should be indented inside if
=============
Q2.
option 3: it contains two tabs
Assuming each tab is 4 spaces, there are 2 tabs. Both the lines under if(): are indented 8 spaces. So assuming the tab setting is 4 spaces, there are 2 tabs.