ta_data = [('peter', 'usa', 'cs262'),
('Andy', 'usa', 'cs212'),
('Sarah', 'England', 'cs101'),
('Gundega', 'Latvia', 'cs373'),
('Job', 'usa', 'cs387'),
('Sean', 'usa', 'cs253')]
ta_facts = [name + ' lives in ' + country + ' and is the TA for ' +
course for name, country, course in ta_data]
for row in ta_facts:
print row
ta_data = [('peter', 'usa', 'cs262'),
('Andy', 'usa', 'cs212'),
('Sarah', 'England', 'cs101'),
('Gundega', 'Latvia', 'cs373'),
('Job', 'usa', 'cs387'),
('Sean', 'usa', 'cs253')]
ta_facts = [name + ' lives in ' + country + ' and is the TA for ' +
course for name, country, course in ta_data]
remote_ta_facts = [name + ' lives in ' + country + ' and is the TA for ' +
course for name, country, course in ta_data if country != 'usa']
ta_300 = [name + 'is the TA for ' course for name, country, course in ta_data if course.finde('cs3') != -1]
for row in ta_facts:
print row
import itertools
def best_hand(hand):
return max(itertools.combinations(hand, 5), key=hand_rank)
def test_best_hand():
assert (sorted(best_hand("6c 7c 8c 9c tc sc js".split()))
==['6c', '7c', '8c', '9c', 'tc'])
assert (sorted(best_hand("td tc th 7c 7d 8c 8s".split()))
==['8c', '8s', 'tc', 'td', 'th'])
assert (sorted(best_hand("td tc th 7c 7d 7s 7h".split()))
==['7c', '7d', '7h', '7s', 'td'])
return 'test_best_hand passes'
print test_best_hand
booge[1].add('red')
booge[1].color='red'
red = 1
houses = [1, 2, 3, 4, 5]
orderings = F(houses)
for(red, green, ivony, yellow, blue) in orderings: