Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lst1 = [('Debt collection', 5572),
- ('Mortgage', 4483),
- ('Credit reporting', 3230),
- ('Checking or savings account', 2068),
- ('Student loan', 431)]
- lst2 = [('Consumer Loan', 480),
- ('Student loan', 1632),
- ('Medical loan', 1632),
- ('Vehicle loan or lease', 377),
- ('Money transfer, virtual currency, or money service', 248),
- ('Payday loan, title loan, or personal loan', 245),
- ('Prepaid card', 83)]
- (non-existent tuple, 0)
- lst1 = [('Debt collection', 5572),
- ('Mortgage', 4483),
- ('Credit reporting', 3230),
- ('Checking or savings account', 2068),
- ('Student loan', 431),
- ('Consumer Loan', 0),
- ('Medical Loan', 0),
- ('Vehicle loan or lease', 0),
- ('Money transfer, virtual currency, or money service', 0),
- ('Payday loan, title loan, or personal loan', 0),
- ('Prepaid card', 0)]
- lst1.append((tpl[0],0) for tpl in
- lst1 for tpl1 in lst2 if tpl1[0] not in tpl)
- [('Debt collection', 5572),
- ('Mortgage', 4483),
- ('Credit reporting', 3230),
- ('Checking or savings account', 2068),
- ('Student loan', 431),
- <generator object <genexpr> at 0x12bc68780>]
- lst1 = [('Debt collection', 5572),
- ('Mortgage', 4483),
- ('Credit reporting', 3230),
- ('Checking or savings account', 2068),
- ('Student loan', 431)]
- lst2 = [('Consumer Loan', 480),
- ('Student loan', 1632),
- ('Medical loan', 1632),
- ('Vehicle loan or lease', 377),
- ('Money transfer, virtual currency, or money service', 248),
- ('Payday loan, title loan, or personal loan', 245),
- ('Prepaid card', 83)]
- available = [tpl[0] for tpl in lst1]
- lst1.extend(tuple((tpl1[0], 0) for tpl1 in lst2 if tpl1[0] not in available))
- print(lst1)
Add Comment
Please, Sign In to add comment