









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










1 / 15
all the work at once and then runs the new program. We're translating the code we wrote to computer code all at once. This is often when we produce an .exe (executable) file.
converting all of the code at once it runs each line as it's needed. It interprets that specific line from your code to computer code.
(values) and does something with them. It is an object capable of manipulating a value. If it is a comparison or logical operator it would compare to see if they are similar or dissimilar. If it is a mathematical operator it would perform mathematical calculations.
final value, while a non-terminal can be reduced further.
Expression Operator Expression The Expression non-terminal that appears on the left side can be replaced by an Expression, followed by an Operator, followed by another Expression. For example, 1 + 1 is an Expression Operator Expression.
string is a sequence of characters surrounded by quotes, either single or double example: myVar = "string data"
2 / 15
Python, the code must match the language grammar exactly. When programming language grammar is not followed the interpreter will return a Syntax Error message. This means that the structure of the code is inconsistent with the rules of the programming language.
character to assign a new value x = 6 x = 9 print x # would print out 9
this called?: Using the + sign to concatenate the values
is what we call selecting a sub-sequence of a string. You do this in Python by specifying the character you want to access by its index position. Index position begins at 0. For example, this code would print out the letter J: name = 'John' print name[0]
is simply obtaining a subset of data from a string. You may have also heard this called string extraction. You do this in Python by specifying the index position where you want to begin and where you want to end. Everything from the starting point up until the end point will be extracted. For example, this code would print out "Jo": name = 'John'
4 / 15 You can only access data from within a function if you return that specific data to be used outside of the function.
number of times, continuing as long as the test expression is True while
a way to control what code executes based on the result of a test expression if
else:
calculations within parentheses. Next work left to right and perform all multiplication and division. Finally, work left to right and perform all addition and subtraction
are working with an expression, they group items within that expressions. Items within parentheses are evaluated first. For example: (5 + 3) * 8 = 64 because we do the addition first, then multiplication 5 + 3 * 8 = 29 because we do the multiplication first, then the addition. We also use parentheses in procedures to define the inputs to that procedure, which is a very different idea than when working within an expression.
5 / 15
value, the result is True and
False value, the result is False and
number starting with 0.
value of something. Lists support mutation, allowing you to change the overall length as well as individual elements within the list.
a way to execute a block once for each element of a list. The syntax is this: for :
position to begin the selection and the index position by which to stop the selection. For example, the following code would print red and yellow because they are at position 0 and 1.The value of 2 tells us to stop the selection at position 2, but not to include it. myColors = ["red","yellow","blue","orange","green"] print
7 / 15 value red: favColors= [['jessica','red'], ['grace','yellow'], ['john','blue']] print favColors[0][1]
elements to the end of the list. The following code would print out the list of red, yellow, blue, orange, green, and purple. myColors = ["red","yellow","blue","orange","green"] myColors.append("purple") print myColors
separate from other objects.
languages?: identity, attributes, and behavior
an object will be, but it isn't the object itself. A class is a blueprint, a detailed description, a definition of an object. The syntax for creating a class in Python is: class
multiple objects that share attributes and behaviors
its own identify and characteristics, separate from other objects. A class describes that object will be, but it isn't the object itself. For example, a house is an object and the blueprints used to create it would be considered the class.
8 / 15 individual object's name that is an instance of the class, a dot, and then the attribute name. For example myClass.color would access the color associated with the object myClass.
one specific example. For example, if I say a table you have an idea of what I mean even though I didn't say if it was wood/glass or big/small. This is the essential idea behind creating classes.
together, but also to protect those contents. Restricts access to the inner workings of a class or any objects based on that class; this is referred to as information hiding or data hiding.
form of code reuse. We can create a new class, but instead of writing it from scratch, we can base it on an existing class. It would inherit some of the characteristics of the base class but could also have its own unique properties and methods that are not shared with the base class.
Means many forms. It lets us automatically do the correct behavior even if what we're working with could take one of many different forms. The + is a great example. If we're adding two variables together with the plus sign, and these variables are integers, it will numerically add them. But if they are two strings it will concatenate them. With classes this allows us to work with objects created from different classes.
goes through each entry one at a time to see if the search word matches the word
10 / 15 lacks a base case it has no way to stop. It is stuck in a loop with a reference pointing to another reference that never resolves. These types of definitions are largely helpful in mathematical application.
function is calling itself, it would be stuck in a loop forever unless we have a condition that would allow the recursion to stop. A recursive definition needs to have two parts: the recursive case and the base case. The base case must be something that you already know the answer for and not need to do anything to work it out. This is what allows us to eventually stop running the definition. The recursive case is when the function is calling itself to run again. The recursive case is defined in terms of itself, but in terms of a smaller version of itself, as progress must be made towards the base case.
using a few simple rules. A simple definition can be used to expand on something much more complex. This involves breaking a problem down into smaller and smaller subproblems until you get to a small enough problem that it can be solved trivially. For example, you could define ancestory = person 1 + ancestors. If you are person 1, your ancestors would be your parents, but they are not your only ancestors. Your parents have parents, but those are still your ancestors. Your grandparents had parents, and so on. A very simple definition can execute with multiple layers and a much more complex value.
allows it to eventually end. It must change its state and move towards the base case. It must call itself recursively.
cost is related to the resources that it requires to execute. The primary way cost is discussed is related to the size of the input. Larger inputs usually mean more
11 / 15 resources, so this is the main factor that determines the speed. Ultimately this determines the amount of time it takes the algorithm to execute and the amount of memory required to run it. The process of calculating this is called algorithm analysis.
13 / 15 accomplish something.
long as an entity exists outside of the described system it can interact with the system. In this case the entity can accomplish something within the system and is considered an actor.
activity or goal.
diagram?: The use case diagram allows you to look more broadly at the requirements of an application by visualizing several use cases and multiple actors at the same time.
diagram?: A class diagram is a visual representation of classes needed. Its most basic structure defines the class name, attributes that it will have, and operations, or methods. This is also where you define inheritance and polymorphism. It allows you to plan out the classes that you will create and their basic structure so that when you translate this to code you know what is needed.
is simply code that is already written, already tested, and ready for you to link to and use. These can greatly reduce the amount of time to write code.
a compiler goes through the code and creates a separate file that contains the machine code. This separate file is an executable file because the computer can directly execute it. All of the code is converted at once and the new compiled file is no longer editable.
the conversion from source code to machine code on-the-fly. There is no
14 / 15 separate machine code file. The computer executes each line when it is needed. This means that all of the code is saved in a format that is editable programming language.
difference is when the code is converted to machine language. A compiled language converts all of the code at one time, before the code is run by the machine, and saves this into a new file. That new file is now machine code, and is not editable. An interpreted language still needs to convert to machine language in order for the computer to understand it, but it does this at the time that the code is executed. The original programming language is preserved, so it is editable.
oriented programming language that is organized around objects or classes, rather than "actions". Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them.
Objective-C C is not object-oriented. It is a procedural language.
apple development
platform language, used for web apps, embedded scripting language inside other applications
cross-platform language, used for small utilities and web apps