CSC108H1 Lecture Notes - Lecture 1: Decimal Mark, Logical Form

129 views4 pages
25 Sep 2017
School
Course
yifanyang and 39659 others unlocked
CSC108H1 Full Course Notes
21
CSC108H1 Full Course Notes
Verified Note
21 documents

Document Summary

[gcc 4. 2. 1 (apple inc. build 5666) (dot 3)] Python type help, copyright, credits or license for more information. # when writing programs, we want to put in english languages explanations. Whatever comes after # symbol is not evaluated. # two types: int (numbers without fractional parts), float. # float = floating-point (numbers that may have a fractional part) # division (/) produces a float result since answer might not be int. # to get an int result use integer division ( // ) # 8 divided by 5 is 1 with a remainder of 3. # to get the remainder, use the remainder (or modulus) operator: % 2 ** 5 # 2 to the power 5. # (1) n % 2 is 0 for even numbers. # (2) n % 2 is 1 for an odd number. # x / y = q * y + r, q = (x // y), r = (x % y)

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents