Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

LPTHW ex37

Python, Learn Python The Hard Way, Exercise 37

TermDefinition
and Called Logical AND operator. If both the operands are true then then condition becomes true. ex. (a and b) is true.
del The del statement is a way to remove an item from a list given its index instead of its value: the del statement. ex. a = [-1, 1, 66.25, 333, 333, 1234.5] del a[0] a [1, 66.25, 333, 333, 1234.5]
from The root of a from-import statement. The from-import statement is used to import specific objects from a module. ex. from x import y
not A negation for the defined operation. ex. not(2 == 1)
while The while loop continues until the expression becomes false. The expression has to be a logical expression and must return either a true or a false value. ex. while (x < 10):
as Used in a 'with' statement to define the alias to assign each result of with x to. ex. with open("x.log") as x
elif A conditional execution statement following an 'if'. Shorthand for an else-if. ex. if x==0: do stuff elif x==1: do more stuff
global The global statement is a declaration which holds for the entire current code block. It means that the listed identifiers are to be interpreted as globals. ex. globes = 0 def glob_1(): global globes globes = 1 def glob_2(): print globes
or Boolean operator to accept if either condition is True, return True. ex. if (1==1 or 1==2):
with The with statement is used to wrap the execution of a block with functionality provided by a separate guard object (see context-managers). This allows common try-except-finally usage patterns to be encapsulated for convenient reuse.
assert The assert statement verifies that the expression defined resolves to true. If it does not it will raise an AssertionError with an optional expression2. ex. assert (x==1 or x==2)
else When all conditional execution statements in an If, Elif block return false, the else will catch and execute. ex. if x==1: do1 elif x==2: do2 else: do3
if A conditional execution statement which executes some code if a statement is True. ex. if you == stinkypant: print "whew!"
pass A null operation. When this is executed nothing happens. ex. if x<0: derp() else pass
yield Return a generator object(like a list or tuple) instead of a static object. ex. def direct(path): yield os.path.walk(path)
break Will exit out of the 'nearest' loop. ex. while x<10: if x<0: break print x x = x+1
except When a try statement fails the except catches the failure and returns. ex. while True: try: num = raw_input(int()) break except: print "Thats not an int."
import The import statement initializes an external module so its functions can be used in the current environment. ex. import os print os.path("c:")
print The print statement will export the argument to STDOUT. ex. print "sup"
class A object that contains functions and can be instantiated. ex. class Man: def height(self): print "TALL DUDE"
exec Allows for the dynamic execution of Python code. ex. test = print "Sup" exec(test)
in When used with an if, allows the code to loop through all members of a generator object. ex. x = 1 if x in [1,2,3,4,5]: print "Sup"
raise Used to call an exception that can be customized per situation. ex. raise Exception, "PC LOAD LETTER"
continue When encountered, causes the application to skip the rest of the current loop. ex. k = [1,2,3,4,5] for x in k: if x>3: print "TOO BEEG" continue print x
finally The finally statement is the cleanup function in a 'try' statement.
is Compares the object identity of two objects. Two objects referencing the same memory location will return True, but objects that are 'equal' will not. ex. 1 == 1 1 is 1 [] == [] [] is []
return Outputs the value returned by a function. This cannot be a generator object as return will only return that it is a generator function. ex. def poop return 2 * 2
def Define a function. ex. def testfunc(poops)
for Iterate through a generator object. The for specifically defines a variable to store each individual iteration as the generator counts through. ex. i = ["Hello","world!"] for x in i: print x
lambda Creates an anonymous function that is not bound to a specific namespace. ex. for i in (1,2,3,4,5): a = lambda x: x * x print a(i)
True Boolean true.
False Boolean false.
None Null
strings A string is a sequence characters which mathematical functions cannot be performed on.
numbers Numbers are a sequence of numbers that math can be performed on.
floats A float is a string of numbers that is equal to 32-bit storage of integers and fraction representing decimal places.
lists A list is a dynamic storage of multiple variables in a single object that can be iterated. Unlike a tuple, lists can be changed after creation.
ES: \\ \
ES: \' '
ES: \" "
ES: \a ASCII bell
ES: \b ASCII backspace
ES: \f ASCII formfeed
ES: \n newline
ES: \r carriage return
ES: \t tab
ES: \v vertical tab :-/
%d signed decimal
%i signed decimal (same as %d)
%u Signed decimal (obsolete)
%o octal
%x signed hex, lowercase
%X signed hex, uppercase
%e floating point in exponential format, lowercase
%E floating point in exponential format, uppercase
%f floating point decimal format
%F floating point decimal format
%g floating point format. Lowercase exponential format if less than -4, decimal format otherwise
%G floating point format. Uppercase exponential format if less than -4, decimal format otherwise
%c Single character
%r String, converts using repr(), "x"
%s string, converts using str(), x
%% No argument converted. Results in '%' in the result
+ add
- subtract
* multiply
** Exponentiation, 'to the power of'
/ divide
// quotient, division without any remainder
% remainder
< less than
> greater than
<= less than or equal to
>= greater than or equal to
== comparison
!= not equal to comparison
<> not equal to comparison (obsolete)
() tuple
[] list
{} set
@ no idea!
= declaration of a variable
+= add to the variable by argument and re-declare as the new value
-= subtract from the variable by the argument and re-declare as the new value
/= divide by the variable by the argument and re-declare as the new value
*= multiply the variable by the argument and re-declare as the new value
//= get the quotient of the variable by the argument and re-declare as the new value
%= Get the remainder by dividing the variable by the argument and re-declaring it as the new value
**= exponentiate the variable by the argument and re-declare as the new value
Created by: 100007898911681
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards