In: Computer Science
THIS IS A PYTHON ASSIGNMENT
1. The following are invalid variable names: 3g, 87 and 2h.
2. The operator != is an example of a relational operator.
3. A variable name identifies the kind of information stored in the object.
4. Python treats the variable names, a1 and A1, as the same variable.
5. The if/else selection structure is a single-selection structure.
6 A fatal logic error causes a program to execute and produce incorrect results.
7) A repetition structure performs the statements in its body while some condition remains
true.
8) Function float converts its argument to a floating-point value.
9) Function call range( 1, 10 ) returns the sequence 1 to 10, inclusive.
10) Sentinel-controlled repetition uses a counter variable to control the number of times a set
of instructions executes.
11) The symbol = tests for equality.
.PYTHON
1. The following are invalid variable names: 3g, 87 and 2h - True
In python,variable names cannot start with a digit.
2. The operator != is an example of a relational operator. - False
The operator != is a comparison operator
3. A variable name identifies the kind of information stored in the object - False
In python, variable names does not contain the data type. variable can be assigned with any kind of information.
4. Python treats the variable names, a1 and A1, as the same variable. - False
Variable in python are case sensitive
5. The if/else selection structure is a single-selection structure. - True
Python allows one set of statements to be executed if a condition is true and another set of actions to be executed if a condition is false.
6. A fatal logic error causes a program to execute and produce incorrect results. - True
Logical errors are the most difficult to fix. They occur when the program runs without crashing, but produces an incorrect result. The error is caused by a mistake in the program’s logic.
7. A repetition structure performs the statements in its body while some condition remains true - True
Repetition structures, or loops, are used when a program needs to repeatedly process one or more instructions until some condition is met, at which time the loop ends.
8. Function float converts its argument to a floating-point value. - True
The float() method is used to return a floating point number from a number or a string.
9. Function call range( 1, 10 ) returns the sequence 1 to 10, inclusive. - False
The function returns the sequence from 1 to 9 inclusive.
10. Sentinel-controlled repetition uses a counter variable to control the number of times a set of instructions executes. - False
Sentinel-controlled repetition is sometimes called indefinite repetition because it is not known in advance how many times the loop will be executed.
11. The symbol = tests for equality. - False
Operator = is for assignment , Operator == tests for equality.