Edited, memorised or added to reading queue

on 14-Aug-2018 (Tue)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

#strategy
According to the skilled strategist Sun Tzu, strategy is about winning before the battle begins, while tactics are about striking at weakness.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




#strategy
“Strategy without tactics is the slowest route to victory. Tactics without strategy are the noise before defeat.”
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




20 CHAPTER 4. LATTICE BOLTZMANN expect that we need a 4 velocity model to fulfill the remaining 4 constraints. But if there was a way to reduce the number of required velocities further we could save some memory and computation time. If you now consider that you will not be interested in the absolute value of the temperature, you can use the determination of the temperature as an additional degree of freedom. You use the 4 equation to determine f 0 −1 , f 0 0 f 1 , and θ.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




e know that the velocity has to be much smaller than the lattice velocity c = 1 and θ is nearly constant. Most standard lattice Boltzmann models use these smaller velocity sets. For models in an arbitrary number of dimensions this usually means that the third moment of the equilibrium distribution function is modified to
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




This description of the simulation of non-ideal fluids is quite superficial. In particular we have only considered the bulk terms of the pressure. There are additional terms which relate to the surface tension. Introducing a forcing of the form of (4.33) will lead to a surface tension
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




It is important to understand the scoping rules of variables inside functions. Each time a function executes, a new local namespace is created. This represents a local environment that contains the names of the parameters and variables that are assigned by the function. To resolve a namespace when a function is called, the Python interpreter first searches the local namespace (that is, the function itself) and if no match is found, it searches the global namespace. This global namespace is the module in which the function was defined. If the name is still not found, it searches the built-in namespace. Finally, if this fails then the interpreter raises a NameError exception. Consider the following code:
a=10; b=20
def my_function():
global a
a=11; b=21
my_function()
print(a) #prints 11
print(b) #prints 20
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 3169709591820

Question
a=10; b=20
def my_function():
    [...] a
    a=11; b=21
my_function()
print(a) #prints 11
print(b) #prints 20
Answer
global

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
ame is still not found, it searches the built-in namespace. Finally, if this fails then the interpreter raises a NameError exception. Consider the following code: a=10; b=20 def my_function(): <span>global a a=11; b=21 my_function() print(a) #prints 11 print(b) #prints 20 <span>

Original toplevel document (pdf)

cannot see any pdfs







Flashcard 3169712737548

Question
If python interpretor finds undefined variable, it raises [...] exception.
Answer
NameError

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
. This global namespace is the module in which the function was defined. If the name is still not found, it searches the built-in namespace. Finally, if this fails then the interpreter raises a <span>NameError exception. Consider the following code: a=10; b=20 def my_function(): global a a=11; b=21 my_function() print(a) #prints 11 print(b) #prints 20 <span>

Original toplevel document (pdf)

cannot see any pdfs







Everything is an object in Python, including modules, classes, and functions, as well as literals such as strings and integers
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 3169720077580

Question
In python everything, including modules, classes, and functions, as well as literals such as strings and integers, is an [...]
Answer
object

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
Everything is an object in Python, including modules, classes, and functions, as well as literals such as strings and integers

Original toplevel document (pdf)

cannot see any pdfs







important distinction needs to be made between mutable and immutable objects. Mutable object's such as lists can have their values changed. They have methods, such as insert() or append(), that change an objects value. Immutable objects, such as strings, cannot have their values changed, so when we run their methods, they simply return a value rather than change the value of an underlying object. We can, of course, use this value by assigning it to a variable or using it as an argument in a function
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 3169726106892

Question
Immutable objects like strings, cannot have their values changed, so when we run their methods (like splice, with ":" notation), they simply [...] rather than change the value of the underlying object.
Answer
return a new value

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
d. They have methods, such as insert() or append(), that change an objects value. Immutable objects, such as strings, cannot have their values changed, so when we run their methods, they simply <span>return a value rather than change the value of an underlying object. We can, of course, use this value by assigning it to a variable or using it as an argument in a function <span>

Original toplevel document (pdf)

cannot see any pdfs







Flashcard 3169730039052

Question
In python, you have string, s, how do you get the index of first occurance of substring 'abc' in s (-1 is returned if 'abc' substring is NOT found)?
Answer
s.find('abc')

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169732398348

Question
Python string method to convert list of chars to string, e.g. ["a", "b", "c"] to "a b c"
Answer
" ".join(["a", "b", "c"])

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169734757644

Question
Python string method to convert string to all lowercase?
Answer
s.lower()

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169737116940

Question
Python string method that swaps out letters for other ones, e.g. "aabbaabb" to "aaccaacc"
Answer
"aabbaabb".replace("bb", "cc")

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169739476236

Question
Python string method that removes leading and ending whitespace (or any other chars), e.g. " abcd\n" to "abcd"
Answer
"abcd\n".strip()

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169741835532

Question
Python string method that converts a string to a list (based on given seperator), e.g. "a,b,c,d" to ["a", "b", "c", "d"]
Answer
"a,b,c,d".split(",")

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169744194828

Question
In Python, convert "abcdef" to "cdef"
Answer
"abcdef"[2:]

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169746554124

Question
In python add 5 to defined list = [1,2,3,4]
Answer
list.append(5)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169748913420

Question
In python add a list to another existing list, item by item, e.g. add [3,4,5] to list=[1,2] so value list will then be [1,2,3,4,5]
Answer
list.extend([3,4,5])

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169751272716

Question
In python, get the index of 2 in list = [1,2,3,4,5]
Answer
list.index(2)
(value will be 1)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169754418444

Question
In python insert 2 in to list = [1,3,4]
Answer
list.insert(1,2)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169756777740

Question
In python, list = [1,2,3,4], what does list.pop(1) do exactly (mention 2 results)
Answer
It returns 2 and changes list to [1,3,4]

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169759137036

Question
In python remove 2 from list = [1,2,3,4] by index!
Answer
list.pop(1)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169761496332

Question
In python remove 2 from list = [1,2,3,4] by value (i.e using 2)
Answer
list.remove(2)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169763855628

Question
In python list = [1,2,3,4], what is the return value of list.remove(2)?
Answer
None
Because lists are mutable so calling their methods will change the underlying list but return nothing.

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3169766214924

Question
Using python list comprehension convert list = [1,2,3,4] to new_list = [2,4,6,8]
Answer
new_list = [i*2 for i in list]

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs