Week_6_Mice_NestedLoops

Week_6_Mice_NestedLoops - CMPT120 J. Ye Nested Loops &...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT120 J. Ye Nested Loops Miscellaneous Stuff ( Week 6 ) Miscellaneous Stuff: more assignment operators escape sequences id and help functions more about docstrings Nested Loops CMPT120 J. Ye 1 Often we perform an operation on a variable, and then store the result back into that variable. Some assignment operators can be used to do this. For example, the statement num += count is equivalent to num = num + count 2 More Assignment Operators
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT120 J. Ye The following are all assignment operators: 3 Operator += -= *= /= %= Example x += y x -= y x *= y x /= y x %= y Equivalent To x = x + y x = x - y x = x * y x = x / y x = x % y More Assignment Operators (cont) In Python, double quotes or single quotes enclose a string (object). What if we want to print the quote character? The following line would confuse Python because it would interpret the second quote as the end of the string print("I said "Hello" to you.") # not ok An
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Week_6_Mice_NestedLoops - CMPT120 J. Ye Nested Loops &...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online