Whsmrsb.weebly.com
Learning PythonUse the following notes to help guide you through the lessons. Use this as a reference sheet as you begin programming.Chapter 2: VariablesData TypesTypeMeaningAbbreviation?IntegerFloatStringReserved KeywordsStatement - _____ line of codeScript - _________________________ of statementsOperatorsSymbolMeaning+-*/**//%Concatenation – Joining __________ (characters) by linking them end to end using the + symbolOther usefulTypeMeaningAbbreviation?User InputNewlineCommentsWhat should you put inside of your input() parenthesis?Types of ErrorsTypeMeaningFix?SyntaxErrorUse before def:CommentsChapter 3: ConditionsBoolean Expression – An expression that is ________ or _______; the operator is ________Comparison OperatorsSymbolMeaning==!=><>=<=Logical OperatorsStatementMeaningandornotConditional statementsStatementMeaningifelifelseWhy is “pass” useful in coding?What are the alternatives in conditional statements called?Types of Conditional statementsStatementMeaningChainedNestedHow can you simplify nested conditional statements?Catching User errors before they happenStatementMeaningTryExceptWhy is reading the error useful?Chapter 4: FunctionsThe variable inside the parenthesis of a function is the ______________; this is a value or variable that ______________ through the function as the ________Simple: Function “_______” an argument and “_______” a resultBuilt-in FunctionsStatementMeaningmax()min()len()int()float()str()Built-in FunctionsA module is a PYTHON object with randomly named attributes that you can combine and reference once you have imported that particular module. Simply, a module is a file consisting of Python code that has been abstracted away. A module can have pre-defined functions, classes, and variables that you can reference. To use a module, we use dot notation (name of module.name of function being called).Random Module (import random)StatementMeaningrandom.random()random.randint(x, y)random.choice(x)Math Module (import math)StatementMeaningmath.sqrt(#)math.sqrt(base, #)math.sin(radians)math.piCreated Functionsdef = defines/creates a new functionWhat is the difference between the following functions?def drawsquare():def drawsquare(length):How do you “call” a function?Will the following code run properly without any errors? Why or why not? (plug it into Trinket and see!)import turtledrawsquare()def drawsquare(): x = 0 while x <= 5: turtle.forward(100) turtle.left(90) x = x + 1What is important about the flow of execution?How does a function “interrupt” the flow of execution?When a function has arguments set inside of it when defined these are called _________________Fruitful Functions – Void Functions – Return statement – How do functions help you use abstraction in your code?Chapter 5: IterationsIncrement – Decrement – How can you stop an infinite loop?How can you skip to the next iteration of a loop?Types of LoopsTypeBest to use when…WhileForWhat is the difference of the two programs below?Chapter 6: StringsString – Index – In programming, the index STARTS at _____To get the LAST letter of a word, what do you need to do?How do you count backwards in a string?Traversal – Explain what the program below is doing:Why does the program below accomplish the same goal?Slice – Immutable – Why does Pineapple come before banana? (HINT: Think about the ASCII table)Important Built-in String MethodsMethodMeaning.isalpha().isnumeric().lower().upper().find(“”).find(“”, index).startswith(“”).replace(“”, “”, count)Invocation – Format operatorStatementMeaning%d%g%sTuple - A sequence of comma-separated values inside a pair of parenthesisChapter 8: ListsThe values in a list are called ___________ or _______To create a list, you must use square brackets [ ]Mutable – You CAN use an index square bracket on the LEFT-hand side to replace an element in a list!If you want to update the elements, you must use the _______!Example: What would numbers[i] = int(numbers[i]) do?Important Built-in List Methods & FunctionsMethodMeaning.append().extend().sort().popdel list[i]removesum()max()len()list()list.split(delimiter/character to use to split)delimiter.join(list)Aliased – What is the difference between append and the operator(+) when it comes to lists?Chapter 9: DictionariesDictionary is like a ____, but the index positions don’t have to be _______Dictionaries are setup with key-value pairs or itemsWhen printing a dictionary, the order of the items might not be in the same _______ because when looking up something in a dictionary, we use the _____ not indexHow can you look up if a VALUE is in a dictionary?Important Built-in Dictionary Methods & FunctionsMethodMeaningdict()get().sort().pop.keys().remove() ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- getroman com reviews
- acurafinancialservices.com account management
- acurafinancialservices.com account ma
- getroman.com tv
- http cashier.95516.com bing
- http cashier.95516.com bingprivacy notice.pdf
- connected mcgraw hill com lausd
- education.com games play
- rushmorelm.com one time payment
- autotrader.com used cars
- b com 2nd year syllabus
- gmail.com sign in