Download presentation
Presentation is loading. Please wait.
Published byAnna Scott Modified over 9 years ago
1
CPTR 124 Review for Test 1
2
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 program 2
3
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)
4
Reserved Words (you should know what red ones do by now) and del from None try as elif global nonlocal True assert else if not while break except import or with class False in pass yield continue finally is raise def for lambda return
5
Logic Logical expressions Nested “if” statements else and elif pass
6
Iteration While For Range Break
7
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
8
How to format printing {} string formatting How the print() function uses its parameters end= and sep= parameters Character codes used in printing (see below)
9
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')
10
Arithmetic & Expressions The difference between assignment and equality (= versus ==) Inequality symbols Different types of division: Floating point Different divide operators
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.