COMP 206 Lecture Notes - Lecture 8: Concatenation, Electronic Industries Alliance, Everytime
Document Summary
Quick start: variables don"t have to be declared before use, but obviously they have to be initialized, sub-statements are denoted by a colon (body of an if) If x>1: print x is bigger than 1. : use print to print. Built-in date structures: numbers: integers, floating-point numbers, complex # (# with real and imaginary part), arbitrary long ints. +, -, *, /, ** (exponentiation) , % abs(), floor(), 7 is not greater than 0 is not 7>0: c-style shifting & masking, int division truncates. 1/2 0. 5, float(1)/2 . 5 int/int = int. Strings: s = hello , and are the same, comp 206\nmessing with python today", he said jump and i said how high? ", not an array of characters with null at the end. Methods: like functions associated with a data type (i. e. a class, s = hello , s. upper() hello , s. lower() hello , upper and lower are methods of the string class, positional operators.