cptr 124 review for test 1. development tools editor similar to a word processor allows programmer...
TRANSCRIPT
CPTR 124 Review for Test 1
Development Tools
• Editor• Similar to a word processor• Allows programmer to compose/save/edit source
code
• Compiler/interpreter• Translates source code into executable form
• Debugger• Allows programmer to trace through the source
code as the program executes
• Profiler• Measures the execution speed of the parts of a
running program2
Identifiers• A variable name is an example of an identifier• An identifier must• Begin with a letter or underscore (A-Z, a-z, _)• Remaining characters may be letters,
underscores, or digits (A-Z, a-z, _, 0-9)• No other characters (including spaces) are permitted
• A reserved word cannot be used as an identifier• Python is case sensitive (capitalization matters)
Reserved Words (you should know what red ones do by now)
and del from None tryas elif global nonlocal Trueassert else if not whilebreak except import or withclass False in pass yieldcontinue finally is raisedef for lambda return
Logic
• Logical expressions• Nested “if” statements• else and elif• pass
Iteration
• While• For• Range• Break
Functions
• How to use them• Especially, how to connect them to your program• From, import, *, module.function, etc.
• How to create them• Variable locality• How to document them using docstrings• Default parameter values
How to format printing
• {} string formatting• How the print() function uses its parameters• end= and sep= parameters
• Character codes used in printing (see below)
String Control Codes
• \n newline• \r carriage return• \t tab• \b backspace• \a bell (alert)• \' single quote (in a single quoted string)• \" double quote (in a double quoted string)• \\ backslash
print('A\nB\nC')print('D\tE\tF')print('WX\bYZ')print('1\a2\a3\a4\a5\a6')
Arithmetic & Expressions
• The difference between assignment and equality (= versus ==)• Inequality symbols• Different types of division:• Floating point• Different divide operators