15 Matching Annotations
  1. Sep 2018
  2. Aug 2018
    1. assignment token = is Python’s assignment token, which should not be confused with the mathematical comparison operator using the same symbol. class see data type below

      Q: What did the watermelon say to the cantaloupe? A: You’re one in a melon

    1. This means get the current value of x, add one, and then update x with the new value. The new value of x is the old value of x plus 1. Although this assignment statement may look a bit strange, remember that executing assignment is a two-step process. First, evaluate the right-hand side expression. Second, let the variable name on the left-hand side refer to this new resulting object. The fact that x appears on both sides does not matter. The semantics of the assignment statement makes sure that there is no confusion as to the result. The visualizer makes this very clear. Next Step Reset

      What do you call a bee that can’t make up its mind? A Maybe

    1. It is important to note that in mathematics, a statement of equality is always true. If a is equal to b now, then a will always equal to b. In Python, an assignment statement can make two variables refer to the same object and therefore have the same value. They appear to be equal. However, because of the possibility of reassignment, they don’t have to stay that way:

      What do you call a thieving alligator? A Crookodile

    1. The input function allows the user to provide a prompt string. When the function is evaluated, the prompt is shown. The user of the program can enter the name and press return. When this happens the text that has been entered is returned from the input function, and in this case assigned to the variable n. Make sure you run this example a number of times and try some different names in the input box that appears.

      I was going to make myself a belt made out of watches, but then I realized it would be a waist of time.

    1. The evaluation of an expression produces a value, which is why expressions can appear on the right hand side of assignment statements. A value all by itself is a simple expression, and so is a variable. Evaluating a variable gives the value that the variable refers to.

      A friend of mine tried to annoy me with bird puns, but I soon realized that toucan play at that game.

    1. If you give a variable an illegal name, you get a syntax error. In the example below, each of the variable names is illegal.

      I hate how funerals are always at 9 a.m. I’m not really a mourning person.

    1. The int function can take a floating point number or a string, and turn it into an int. For floating point numbers, it discards the decimal portion of the number - a process we call truncation towards zero on the number line. Let us see this in action:

      All these sea monster jokes are just Kraken me up.

    1. These objects are classified into different classes, or data types: 4 is an integer, and "Hello, World!" is a string, so-called because it contains a string or sequence of letters. You (and the interpreter) can identify strings because they are enclosed in quotation marks. If you are not sure what class a value falls into, Python has a function called type which can tell you.

      I’m only friends with 25 letters of the alphabet. I don’t know Y.

    1. activecode A unique interpreter environment that allows Python to be executed from within a web browser. algorithm A general step by step process for solving a problem. bug An error in a program. byte code An intermediate language between source code and object code. Many modern languages first compile source code into byte code and then interpret the byte code with a program called a virtual machine. codelens An interactive environment that allows the user to control the step by step execution of a Python program 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. compile To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution. debugging The process of finding and removing any of the three kinds of programming errors. exception Another name for a runtime error. executable Another name for object code that is ready to be executed. formal language Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are formal languages. high-level language A programming language like Python that is designed to be easy for humans to read and write. interpret To execute a program in a high-level language by translating it one line at a time. low-level language A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language. natural language Any one of the languages that people speak that evolved naturally. object code The output of the compiler after it translates the program. parse To examine a program and analyze the syntactic structure. portability A property of a program that can run on more than one kind of computer. print function A function used in a program or script that causes the Python interpreter to display a value on its output device. problem solving The process of formulating a problem, finding a solution, and expressing the solution. program A sequence of instructions that specifies to a computer actions and computations to be performed. programming language A formal notation for representing solutions. Python shell An interactive user interface to the Python interpreter. The user of a Python shell types commands at the prompt (>>>), and presses the return key to send these commands immediately to the interpreter for processing. runtime error An error that does not occur until the program has started to execute but that prevents the program from continuing. semantic error An error in a program that makes it do something other than what the programmer intended. semantics The meaning of a program. shell mode A style of using Python where we type expressions at the command prompt, and the results are shown immediately. Contrast with source code, and see the entry under Python shell. source code A program, stored in a file, in a high-level language before being compiled or interpreted. syntax The structure of a program. syntax error An error in a program that makes it impossible to parse — and therefore impossible to interpret. token One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.

      Very interesting.... wawwwwww :O