"Python Language Programming" Wang Kai Wang Zhi Machinery Industry Press Chapter 1 Getting to Know Python Answers to After-school Exercises

1.6 Exercises after class
(1) There are two ways to translate high-level language into machine language: one is compilation and the other is interpretation. Python is an interpreted language

(2) The Python program supports two modes of operation: interactive and scripted

(3) Python's single-line comments start with the # symbol, and the text behind the symbol is a comment

(4) The function of the input function is to receive standard input data (that is, input from the keyboard) and return it as a String type (string)

(5) The function of the print function is to output data of various types (strings, integers, floating point numbers, lists, dictionaries, etc.) to the screen

(6) IDLE has two window modes: Shell and Editor (editor).

(7) The following is not an advantage of the Python language (C)

         A. Easy to learn B. Free and open source C. Mandatory indentation D. Rich library

(8) The correct statement about Python is (B)

         A. Single-line comments start with a semicolon ";"

         B. Multi-line comments start and end with 3 single quotes "'''" or 3 double quotes """""

         C. Multi-line comments start and end with 3 "#"

         D. Comments are also program codes that participate in the operation of the program

(9) Known statement r= eval (input("Please enter a valid expression:")), then the wrong operation is (D)

         A. If you input 4+7, you can get the result 11 by print(r)

         B. If you input 4*2.5+10, you can get the result 20 by print(r)

         C. If you enter 5*/3, a SyntaxError will be reported because it is not a valid expression

         D. If you input 3+5, you can get the result 3+5 by print(r)

(10) Briefly describe the advantages of the Python language

           Advantages: easy to learn: simple syntax, less code;

                      Free and open source: open source code;

                      Cross-platform: can be ported to Linux, Windows, Macintosh, Android and other platforms;

                      High-level languages: ignore low-level details;

                      Object-oriented: in line with the way humans understand the objective world;

                      Rich libraries: Provides internal standard libraries and rich third-party libraries;

                      Glue language: the advantages of gluing modules written in other programming languages ​​​​like using glue

(11) Briefly describe the application of Python in the four fields of scientific computing, database programming, Web programming and artificial intelligence

           Scientific computing: Since 1997, NASA has used Python extensively for various complex scientific operations. With the development of many program libraries such as NumPy, SciPy, Matplotlib, Enthought, libraries, etc., Python is becoming more and more suitable for scientific computing and drawing high-quality two-dimensional and three-dimensional images

           Database programming: Programmers can communicate with databases such as Microsoft SQL Server, Oracle, Sybase, DB2, MySQL, and SQLite through modules that follow the Python DB-API (Database Application Programming Interface) specification. In addition, Python comes with a Gadfly module that provides a complete SQL environment

           Web programming: Python has many free data function libraries, free web page template systems, and libraries for interacting with web servers, which can realize web development and build web frameworks. The Web project developed with Python is small and precise, supports the latest XML technology, and has relatively powerful data processing functions

           Artificial intelligence: In terms of neural network and deep learning, Python can find more mature packages to call. Python is an object-oriented dynamic language and is suitable for scientific computing
 

Guess you like

Origin blog.csdn.net/weixin_49647262/article/details/122027935