CS212– Session V–Learnings
To flip 1 to 0 and 0 to 1, you can use a dict – {‘0’:1,’1’:0}
If there are many values to unpack from a tuple, it is better to use namedtuple.
from collections import namedtuple
State =namedtuple(‘State’,’p me you pending’)
s = State(1,2,3,5)
s.p is 1
s.me is 2
s.you is 3
s.pending is 4
I used input_list[random.randint(1)] … Peter’s function was elegant random.choice(input list) gives a random item from the list
Instead of writing if return else return ….you can club them in to one statement like this : return ‘hold’ if (condition) else ‘roll’
dependency injection
Probability
Search with uncertainty
Utility- how and what
Use simulation / enumeration
Aspect oriented programming..need to look at stuff
Exploratory data analysis