8 Matching Annotations
  1. Nov 2023
    1. The technique of start small and keep improving is the basis of Agile software development. This practice is used widely in the industry.

      The technique of start small and keep improving is the basis of Agile software development. This practice is used widely in the industry.

    1. When you are happy you want to go on and solve the next little problem. Essentially I’m telling you once again, start small, get something small working, and then add to it.

    1. prompt the user for the amount of inches they would like to convert

      inches = input("How many inches would you like to convert?")

      convert the inches to an integer

      inches_int = int(inches)

      convert to feet

      feet = inches_int / 12

      print the amount of feet

      print(feet)

    1. Assignment¶A statement that assigns a value to a variable. Concatenate¶To join two operands end to end. Comment¶Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program. Evaluate¶To simplify an expression by performing the operations in order to yield a single value. Expression¶A combination of variables, operators, and values that represents a single result value. Floating Point¶A type that represents numbers with fractional parts. Integer¶A type that represents whole numbers. Keyword¶A reserved word that is used by the compiler to parse a program; you cannot use keywords like if, def, and while as variable names. Mnemonic¶A memory aid. We often give variables mnemonic names to help us remember what is stored in the variable. Modulus Operator¶An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another. Operand¶One of the values on which an operator operates. Operator¶A special symbol that represents a simple computation like addition, multiplication, or string concatenation. Rules of Precedence¶The set of rules governing the order in which expressions involving multiple operators and operands are evaluated. Statement¶A section of code that represents a command or action. So far, the statements we have seen are assignments and print expression statement. String¶A type that represents sequences of characters. Type¶A category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str). Value¶One of the basic units of data, like a number or string, that a program manipulates. Variable¶A name that refers to a value.

      Assignment A statement that assigns a value to a variable.

      Concatenate To join two operands end to end.

      Comment Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.

      Evaluate To simplify an expression by performing the operations in order to yield a single value.

      Expression A combination of variables, operators, and values that represents a single result value.

      Floating Point A type that represents numbers with fractional parts.

      Integer A type that represents whole numbers.

      Keyword A reserved word that is used by the compiler to parse a program; you cannot use keywords like if, def, and while as variable names.

      Mnemonic A memory aid. We often give variables mnemonic names to help us remember what is stored in the variable.

      Modulus Operator An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.

      Operand One of the values on which an operator operates.

      Operator A special symbol that represents a simple computation like addition, multiplication, or string concatenation.

      Rules of Precedence The set of rules governing the order in which expressions involving multiple operators and operands are evaluated.

      Statement A section of code that represents a command or action. So far, the statements we have seen are assignments and print expression statement.

      String A type that represents sequences of characters.

      Type A category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str).

      Value One of the basic units of data, like a number or string, that a program manipulates.

      Variable A name that refers to a value.

    1. from datetime import datetime today = datetime.today() age_str = input('What is your age?\n') age = int(age_str) birth_year = today.year - age print("You were born in " + str(birth_year) + " or " + str(birth_year - 1))

    1. There are some low-level conceptual patterns that we use to construct programs. These constructs are not just for Python programs, they are part of every programming language from machine language up to the high-level languages.

      input Get data from the “outside world”. This might be reading data from a file, or even some kind of sensor like a microphone or GPS. In our initial programs, our input will come from the user typing data on the keyboard.

      output Display the results of the program on a screen or store them in a file or perhaps write them to a device like a speaker to play music or speak text.

      sequential execution Perform statements one after another in the order they are encountered in the script.

      conditional execution Check for certain conditions and then execute or skip a sequence of statements.

      repeated execution Perform some set of statements repeatedly, usually with some variation.

      reuse Write a set of instructions once and give them a name and then reuse those instructions as needed throughout your program.

    1. x = 6 print(x) 6 y = x * 7 print(y) 42 In this example, we ask Python to remember the value six and use the label x so we can retrieve the value later. We verify that Python has actually remembered the value using print. Then we ask Python to retrieve x and multiply it by seven and put the newly computed value in y. Then we ask Python to print out the value currently in y