====== 1. Python Language Reference ====== Programming languages are a tool. While many modern programming languages are designed to be general purpose, some programming languages may be better suited to solve certain problems than others. ===== When to use Python3 ===== While efficiency of a //program// is key to solving many contest problems, efficiency of the //programmer// is also critically important. Python3 is known for its expressive nature: problems that are solvable in Python3 are often solvable in far fewer lines than would be required in [[cpp|C++]] or Java((At the time of the initial version of this guidebook, Java is not currently supported by the guidebook authors.)). Some of the easiest real-world contest problems can be solved in fewer than 5 or 10 lines of Python3 code. A firm grasp of Python3 may make the difference in solving easy and medium level problems, and doing so faster than other competitors. ===== When not to use Python3 ===== The reverse is also true. Python3 may be the //wrong// choice for other problems. While Python3 boosts programmer efficiency, it inherently lacks runtime efficiency. Python3 cannot compete with well written [[cpp|C/C++]]/Java code. Certain contest problems may not be solved within prescribed time bounds using Python3. Fortunately, while a wrong choice of Python3 can be a (potentially major) setback in an actual competition, Python3 code follows many common pseudocode conventions and can be quickly converted to [[cpp|C++]] or Java code. Such converted code is likely to perform significantly before it is optimized. Python3 is a natural choice for many of the problems that are selected for the first half of a programming contest. ===== Input/Output ===== * [[python3:input|Input]] for Programming Contests * [[python3:output|Output]] for Programming Contests ===== Data Structures ===== ==== Sequential Structures ==== * [[python3:list|Lists]] * [[python3:string|Strings]] * [[python3:tuple|Tuples]] * [[python3:stack|Stacks]] * [[python3:queue|Queues]] * [[python3:priority_queue|Priority Queues]] === Sequential Structures: Operators and Functionality === * [[python3:slicing | Indexing and Slicing]] * [[python3:unpacking | Unpacking]] ==== Non-Sequential Structures ==== * [[python3:dictionaries|Dictionaries]] * [[python3:sets|Sets]] ===== Functional Programming ===== ==== Recursion ==== * [[python3:recursion_depth|Recursion Limits]] ==== Higher Order Functions ==== * [[python3:functional_intro|Introduction]] * [[python3:list_comprehensions|List Comprehensions]] * [[python3:map_reduce_filter|Map, Reduce, and Filter]] * [[python3:lambdas|Lambda Expressions]] ==== Memoization ==== * [[python3:lru_cache|Automatic Memoization: LRU Cache]] ===== Generators ===== * [[python3:itertools|Itertools]] * [[python3:generators|Generators]] ===== Mathematical Types and Operations ===== ==== Numeric Types ==== * [[python3:decimal|Decimal]] * [[python3:fractions|Fractions]]