Python Programming Chapter 2 Summary-Questions and Answers
Python Programming Chapter 2 Summary-Questions and Answers Steps to writing a program - ANSWER-1. Problem Analysis: Studying the problem to be solved 2. Program Specification: Deciding exactly what the program will do. 3. Design: Writing an algorithm in pseudocode. 4. Implementation: Translating the design into a programming language. 5. Testing/Debugging: Finding and fixing errors in the program. 6. Maintenance: Keeping the program up to date with evolving needs. IPO - ANSWER-Many simple programs follow the input process output (IPO) pattern Programs are composed of statements that are built from - ANSWER-identifiers and expressions Identifiers - ANSWER-names; begin with an underscore or a letter which can be followed by a combination of letter, digit, or underscore characters; are case-sensitive in Python Expressions - ANSWER-fragments of a program that produce data; can be composed of literals, variables and operators literals - ANSWER-a representation of a specific value; 3 is a literal representing the number three variables - ANSWER-an identifier that stores a value; a named piece of memory operators - ANSWER-used to combine expressions into more complex expressions; in x + 3 * y the operators + and * are used; includes usual arithmetic operations of addition(+), subtraction(-), multiplication(*), division(/), and exponentation(**) The Python output statement print - ANSWER-displays the values of a series of expressions to the screen Assignment - ANSWER-assignment of a value to a variable is indicated using the equal sign (=). using assignment, programs can get input from the keyboard; Python also allows simultaneous assignment, which is useful for getting multiple input values with a single prompt The eval function can be used to evaluate input.. - ANSWER-..but it is a security risk and should not be used with input from unknown or untrusted sources
Document information
- Uploaded on
- March 28, 2024
- Number of pages
- 2
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers