SYSC 1005 Study Guide - Midterm Guide: Unary Operation, Docstring

73 views1 pages

Document Summary

Prompt : >>> us to type (no show on screen) not used before answers python gives. Assignment operator : = (variable = expression) Variable: num = 1 (assign/bound right to left: = ) Divide: / - (always real number answer. Decimals displayed are same as in actual answer) Integer division (floor operator): // (rounds down to lowest int even for -# & floats so - Remainder of /: % (int, int gives int but float, int gives float) Line cont: \ => 3+\ 4 7 or brackets (2+ 3) 5 (indent before broken line!) Relation bwt // % can help calculate %: x = y * (x // y) + (x % y) Negation: ---5 = -5 or (3+4) = 7. +1 or ++1 allowed but not 1 + Invert operator: ~ (unary operator (only for integers): ~x defined as -(x+1) or ((-x)+1) ( (eg. ~-7 = 6)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents