Chapter Test One Answer

Hello, I am Yuechuang. Welcome to the actual combat of Python core technology, this is your first test, come on!

1. Which of the following variables can be used as python variables:

A. 01a B. class C. a_int D. b-int

Answer analysis

Correct answer: C Error-prone item: B

The variable name naming rule must be a combination of uppercase and lowercase English, numbers and _, and cannot start with a number, and cannot use keywords in python as variable names. Where B is a keyword in python, you can enter the interactive environment on the command line and enter help('keywords') to view the list of python keywords.

2. Which of the following options is not a basic data type keyword of Python

A. int B.bool C. string D. dict

Answer analysis

Correct answer: C Error-prone item: B

The key of the string is str in python

3. This question does not need to be answered online, please check the answer after answering on paper

After the statement x, y, z = 1, 2, 3 is executed, the value of the variable y is __ _____ _.

Please leave a comment below the revised article and leave your answer!

Answer analysis

Correct answer: 2

4. This question does not need to be answered online, please check the answer after answering on paper

The Python built-in function for viewing variable types is ________________.

Answer analysis

Correct answer: type()

Memorable knowledge points

5. This question does not need to be answered online, please check the answer after answering on paper

Please write the output result of this code_____________.

  a = 'ABC'
  b = a
  a = 'XYZ'
  print(b)
Answer analysis

Correct answer: ABC

Executing a ='ABC', the interpreter creates the string'ABC' and variable a, and points a to'ABC': Executing b = a, the interpreter creates the variable b, and points b to the string pointed to by a' ABC': Execute a ='XYZ', the interpreter creates the string'XYZ', and changes the direction of a to'XYZ', but b has not changed: So, the result of printing variable b at the end is naturally'ABC' Up.

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_33254766/article/details/109039303