Edited, memorised or added to reading list

on 29-Aug-2019 (Thu)

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

Flashcard 4348457127180



Tags
#bones #bony #has-images #knee #landmarks #leg #patella


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






Flashcard 4353801194764

Question
How to merge two dictionaries
Answer
>>> x = { 'a' : 1, 'b' : 2} >>> y = { 'b' : 3, 'c' : 4} >>> z = { ** x, ** y} >>> z {'c': 4, 'a': 1, 'b': 3} # In Python 2.x you could # use this: >>> z = dict (x, ** y) >>> z {'a': 1, 'c': 4, 'b': 3} # In these examples, Python merges dictionary keys # in the order listed in the expression, overwriting # duplicates from left to right.


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Unknown title
# How to merge two dictionaries # in Python 3.5+ >>> x = {'a': 1, 'b': 2} >>> y = {'b': 3, 'c': 4} >>> z = {**x, **y} >>> z {'c': 4, 'a': 1, 'b': 3} # In Python 2.x you could # use







Flashcard 4353805913356

Question
# Different ways to test multiple # flags at once in Python
Answer

x, y, z = 0, 1, 0

if x == 1 or y == 1 or z == 1: print ( 'passed' )

if 1 in (x, y, z): print ( 'passed' )

# These only test for truthiness:

if x or y or z: print ( 'passed' )

if any ((x, y, z)): print ( 'passed' )


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Unknown title
# Different ways to test multiple # flags at once in Python x, y, z = 0, 1, 0 if x == 1 or y == 1 or z == 1: print('passed') if 1 in (x, y, z): print('passed') # These only test for truthiness: if x or y or z: print('passed') if any((x, y, z)):







Flashcard 4353810369804

Question
# The get() method on dicts # and its "default" argument
Answer

name_for_userid = { 382: "Alice" , 590: "Bob" , 951: "Dilbert" , }

def greeting(userid): return "Hi %s!" % name_for_userid . get(userid, "there" )

>>> greeting(382) "Hi Alice!"

>>> greeting(333333) "Hi there!"


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Unknown title
# The get() method on dicts # and its "default" argument name_for_userid = { 382: "Alice", 590: "Bob", 951: "Dilbert", } def greeting(userid): return "Hi %s!" % name_for_userid.get(userid, "there") >>> greeting(382) "Hi Alice!" >&







Flashcard 4353815874828

Question
# Using namedtuple is way shorter than # defining a class manually:
Answer

>>> from collections import namedtuple

>>> Car = namedtuple( 'Car' , 'color mileage' ) # Our new "Car" class works as expected:

>>> my_car = Car( 'red' , 3812.4)

>>> my_car . color

'red'

>>> my_car . mileage

3812.4

# We get a nice string repr for free:

>>> my_car Car(color='red' , mileage=3812.4)

# Like tuples, namedtuples are immutable:

>>> my_car . color = 'blue' AttributeError: "can't set attribute"


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Unknown title
# Why Python is Great: Namedtuples # Using namedtuple is way shorter than # defining a class manually: >>> from collections import namedtuple >>> Car = namedtuple('Car', 'color mileage') # Our new "Car" class works as expected: >>> my_car = Car('red', 3812.4) &







Flashcard 4353852312844

Tags
#christina
Question
Tia
Answer
786738


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






Flashcard 4353855196428



Tags
#bones #bony #has-images #knee #landmarks


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






Flashcard 4353860701452



Tags
#bones #bony #has-images #knee #landmarks


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






Flashcard 4353867255052



Tags
#bones #bony #has-images #knee #landmarks


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






Flashcard 4353872760076



Tags
#bones #bony #has-images #knee #landmarks


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






Flashcard 4353879051532



Tags
#bones #bony #femur #has-images #landmarks #master


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






Flashcard 4353884556556



Tags
#bones #bony #femur #has-images #landmarks


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






Flashcard 4353890061580



Tags
#bones #bony #femur #has-images #landmarks


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